Separating a colymn into two columns (.txt file)
8 views (last 30 days)
I would like to separate a column into two different columns from a .txt file in Matlab. I used these commands:
and the results of these commands are in the pictures. Finally, I mean that i would like to separate line 11 into two vertical columns.
Which command should I use?
David K. on 24 Sep 2019
Edited: David K. on 24 Sep 2019
I would do it like this:
%t = your table;
dataCell = table2cell(t); % convert to cells
dataCell = dataCell(11:end); % remove unneccessary text
cellNums = cellfun(@str2num,dataCell,'UniformOutput',0); % apply str to num on all the data
output = cell2mat(cellNums); % convert to matrix with 2 columns
*Edit: fixed a few things