I have a data file containing 100 lines with the following format
0,device1,3 1,device2,33 2,device3,3 3,device4,34 ... 99,device100,36
Now I wish to read them into a 100x3
cell array in MATLAB. I did the following:
allData = textscan(fID,'%s %s %f', 'delimiter', ',');
Then, I noticed that allData
is a 1x3
cell array with each item being another 100x1
cell array. (The first two columns are string-type cell arrays, whereas the third column is double-type cell array)
In other words, the reading result is a nested
array, which I don't want.
How may I achieve 100x3
cell array directly while reading?