Add row numbers to side of table in MATLAB

35 views (last 30 days)
This is my code:
T = table(Name,Team,DVOA);
T.Name = categorical(T.Name);
T.Team = categorical(T.Team)
This is the output:
I need to add row numbers to the left-hand side of the table. Please help.
The result should look like this:

Answers (1)

Chris
Chris on 19 Apr 2022
Edited: Chris on 19 Apr 2022
rownums = 1:size(T,1);
T.Properties.RowNames = string(rownums);

Categories

Find more on Tables in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!