How do I add a column to table?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (3)
Sean de Wolski
le 20 Nov 2015
T.EleventhColumn = rand(8,1);
Where 'EleventhColumn' is the name you want for the variable.
2 commentaires
Theodore Wilkening
le 13 Mar 2020
this works best.
Yifei
le 26 Nov 2022
The most convenient approach.
thang ngo
le 24 Juil 2020
14 votes
This helps to pass a name as parameter:
name = 'new_column'
T.(name) = rand(8,1);
Ehab Abdelkarim
le 3 Août 2018
2 votes
you may want to check the following link https://de.mathworks.com/help/matlab/matlab_prog/add-and-delete-table-variables.html
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!