Adding a column to table

1,803 views (last 30 days)
m m
m m on 19 Nov 2015
Commented: Yifei on 26 Nov 2022
Hey everyone.
I have created my own csv-file. When I use readable to load the table, I get a 8x10 table. I want to expand the table to a 8x11 table where the 11th column should have the values from a function I have created. Can anyone help me with this(I have to give the 11th column a title as well)?

Accepted Answer

Walter Roberson
Walter Roberson on 20 Nov 2015

More Answers (3)

Sean de Wolski
Sean de Wolski on 20 Nov 2015
T.EleventhColumn = rand(8,1);
Where 'EleventhColumn' is the name you want for the variable.
  2 Comments
Theodore Wilkening
Theodore Wilkening on 13 Mar 2020
this works best.
Yifei
Yifei on 26 Nov 2022
The most convenient approach.

Sign in to comment.


thang ngo
thang ngo on 24 Jul 2020
This helps to pass a name as parameter:
name = 'new_column'
T.(name) = rand(8,1);

Ehab Abdelkarim
Ehab Abdelkarim on 3 Aug 2018
you may want to check the following link https://de.mathworks.com/help/matlab/matlab_prog/add-and-delete-table-variables.html

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!