How can I un-nest a cell array of different type cells?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Odysseas Makariou
am 28 Mai 2022
Kommentiert: Voss
am 28 Mai 2022
Hello, I have a 1x6 cell array where each element is a 22x1 cell or double array (the cell arrays contain text)
I want to expand the whole cell and then convert it to a table of the following format
X 1 Y 1 Z 1
X 2 Y 2 Z 2
X 3 Y 3 Z 3
X 4 Y 4 Z 4
.
.
.
.
X 22 Y 22 Z 22
I used cell2table and writecell but it doesn't help
Essentially I want to end up with a 22x6 table with letters on columns 1,3,5 and numbers on columns 2,4,6, and then and then convert the table to a txt file
Thank you.
0 Kommentare
Akzeptierte Antwort
Voss
am 28 Mai 2022
C = {{'X';'X';'X'} [1;2;3] {'Y';'Y';'Y'} [1;2;3] {'Z';'Z';'Z'} [1;2;3]} % your cell array
T = table(C{:}) % make a table T
writetable(T) % write the table to a text file
% check the file:
ls
type T.txt
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!