MATLAB: How to turn a 1 by 1 cell to n by1 cell

cell arraysmatrix arraytextscan

Hi, I use textscan to read a text file, my results in editor shows that it is a 117 by 1 cell, however it's displayed as a 1 by 1 cell in the workspace. When I click on it, it shows the 117 elements one by one in a matrix form. I need to read this cell as 117 by 1 because I will use it as my source of comparison to other text files.How can I store it as a 117 by 1 in my workspace?

Best Answer

You probably have something like
data = textscan(fid, '%s');
Then the result of that is going to be a 1 x 1 cell, the content of which would be an N x 1 cell array of character vectors. To get the cell array of character vectors, you would only need to use
data{1}
in the above case.
The size of the cell array returned by textscan() is equal to the number of different format items you have, except in cases where you have CombineOutput set in the options. So for example if you had a format specifier of '%s %f %f' then you would get a 1 x 3 cell array as output, one entry per column.