What is the code to add one row above in table?
Ältere Kommentare anzeigen
Hi! This might be an easy question, but since I am new in matlab, I do not know how to add one row in the first row of table. have a table consist only one column called "timediff" with the size 2143x1 table, I want to make it 2144x1 table, with the addition one row in the first row, and the value is 0. Could you please help me? Thank you in advance
Akzeptierte Antwort
Weitere Antworten (1)
Peter Perkins
am 16 Nov. 2017
My first observation is that if your table has only one variable, you are likely better off not using a table. They are containers for mix-type data. But your Nx1 table may just be a starting point for more vars.
To add a row at the beginning, do exactly the same thing you would do with a numeric vector: use vertcat.
>> t = table([1;2;3])
t =
3×1 table
Var1
____
1
2
3
>> t = [table(0); t]
t =
4×1 table
Var1
____
0
1
2
3
Kategorien
Mehr zu Tables finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!