Filter löschen
Filter löschen

How to split into different tables a multi-level cell?

1 Ansicht (letzte 30 Tage)
JoanManBar
JoanManBar am 2 Dez. 2017
Kommentiert: JoanManBar am 6 Dez. 2017
My final goal is to have a 428x11 table from an image analysis that I ran which final outcome is 'data'. Object 'data' is a 428x1 cell, and that one column is a 1x11 cell that looks like ['name', v1, v2, v3, v4, v5, 6, v7, v8, V9, v10], and again, 428 times.
I have tried using data_table=regexp(data(:), '\s+', 'split'); but get an error using regexp 'All cells must be char row vectors.', and tried with 'cellstr' but didn't work. I have also tried with loops -although I am not proficient with iterations- but I can't index with multi-level cells, and something like data2=data{2:end,1}{1,1}; or data2=data{:,1}{:,1}; hasn't worked. I have seen similar questions in but MATLAB Answers haven't worked for me so far.
I really appreciate any help!

Akzeptierte Antwort

per isakson
per isakson am 2 Dez. 2017
Bearbeitet: per isakson am 2 Dez. 2017
"final goal is to have a 428x11 table"
Study this
data = {
{'name1',1,2,3,4,5,6,7,8,9,0}
{'name2',1,2,3,4,5,6,7,8,9,0}
{'name3',1,2,3,4,5,6,7,8,9,0}
};
cac = cat( 1, data{:} );
mytable = cell2table( cac )
it displays in the command window
mytable =
cac1 cac2 cac3 cac4 cac5 cac6 cac7 cac8 cac9 cac10 cac11
_______ ____ ____ ____ ____ ____ ____ ____ ____ _____ _____
'name1' 1 2 3 4 5 6 7 8 9 0
'name2' 1 2 3 4 5 6 7 8 9 0
'name3' 1 2 3 4 5 6 7 8 9 0
  12 Kommentare
JoanManBar
JoanManBar am 6 Dez. 2017
Once again, thank you very much! I'm having some trouble with that last part since 'body' is not defined but I think it's time for me to stop bothering you and do the work myself.
I have learned more from your answers than from my experience reading the MATLAB documentation and I really appreciate that.
JoanManBar
JoanManBar am 6 Dez. 2017
I got it. you are brilliant, Per Isakson!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data 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!

Translated by