如何在matlab中读取行到单元格数组

Mon*_*RPG 4 file-io matlab

我想在matlab中将常规文本文件读入单元格数组.我怎样才能做到这一点 ?

我不想要任何格式化.读作文字.

谢谢.

它将是基于行的数组,如100x1

example of reading : dd = {1;2;3}
Run Code Online (Sandbox Code Playgroud)

Jon*_*nas 15

使用textscan,所以每行有一个单元格元素:

fid = fopen('myFile.ext');
allData = textscan(fid,'%s','Delimiter','\n');

% allData{1} is a nLines-by-1 cell array with the lines of the file as text
Run Code Online (Sandbox Code Playgroud)