How do I add a column to table?
Ältere Kommentare anzeigen
I have created a CSV file. When I use the "readable" function to load the table, I get an 8x10 table. I want to expand the table to an 8x11 table, where the 11th column should have the values from a function I have created. How do I do this?
Akzeptierte Antwort
Weitere Antworten (3)
Sean de Wolski
am 20 Nov. 2015
T.EleventhColumn = rand(8,1);
Where 'EleventhColumn' is the name you want for the variable.
2 Kommentare
Theodore Wilkening
am 13 Mär. 2020
this works best.
Yifei
am 26 Nov. 2022
The most convenient approach.
thang ngo
am 24 Jul. 2020
14 Stimmen
This helps to pass a name as parameter:
name = 'new_column'
T.(name) = rand(8,1);
Ehab Abdelkarim
am 3 Aug. 2018
2 Stimmen
you may want to check the following link https://de.mathworks.com/help/matlab/matlab_prog/add-and-delete-table-variables.html
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!