split value in table two columns
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Venkatkumar M
am 13 Dez. 2021
Bearbeitet: Image Analyst
am 13 Dez. 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/833185/image.jpeg)
Table look this in matlab(attached the table). another table looks like below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/833190/image.jpeg)
I want to separate 2nd colum into two columns.
one column before comma
another column after comma
Could any one please help me with it?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 13 Dez. 2021
Bearbeitet: Image Analyst
am 13 Dez. 2021
I see a lot of unaccepted answers in your post posting history. You might want to accept some of them to award the people who helped you "reputation points."
This works:
data = readcell('Freq_complex.txt')
[rows, columns] = size(data)
counter = 0;
for row = 1 : rows
thisCellContents = data{row, 1};
if contains(thisCellContents, 'Freq')
% Skip a text line in the middle of all the data.
continue;
end
counter = counter + 1;
column1(counter) = str2double(thisCellContents(1:21));
column2(counter) = str2double(thisCellContents(23:end-1));
column3(counter) = data{row, 2};
end
fprintf('Done parsing %d lines of data to get %d numbers per vector.\n', rows, counter)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!