Uneven Table concatenation issue
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alyna
am 16 Dez. 2014
Bearbeitet: per isakson
am 16 Dez. 2014
I'm looking to make a table that has 9 row. Rows 1-7 have 5 columns, but rows 8 and 9 will only have 3 columns. MATLAB keeps giving me the error that this won't work because the rows must be the same length (Three columns have 9 items while 2 only have 7 items)
How can I get around this? Would adding zeros to the end of the data be easiest?
*The 8th and 9th row are also averages and std. deviations of their columns so if someone could also explain how to add these into the table without making them a new column, that would also be greatly appreciated!!
0 Kommentare
Akzeptierte Antwort
per isakson
am 16 Dez. 2014
Bearbeitet: per isakson
am 16 Dez. 2014
Not 0, NaN is a better choice.
The documentation on table discusses missing data at length , e.g. Clean Messy and Missing Data in Tables. Let that be a starting point.
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 16 Dez. 2014
You can't do that. A table has to be rectangular and each column must be the same data type. You can add 0's in columns 8 and 9 like you suggested but that's the only way. Or you can use a cell array instead of a table and just have the columns 8 and 9 be empty/null.
Why not just have 2 arrays? Why does it all need to be in a single variable, especially since there's some difference in what columns 8 and 9 represent?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Tables 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!