how to make a table from matrix data?

46 views (last 30 days)
Abraham Chan
Abraham Chan on 11 Nov 2015
Answered: Peter Perkins on 12 Nov 2015
'beginner in Matlab'
name={'Senior 1' 'Senior 2'};
day={'Monday' 'Tuesday' 'Wednesday'};
How do i make this table from a variable with data inside?
The code gives me error. This is what i want.
T =table(matrix,...
I dont want to type one by one into the code.
T =table(matrix,...
'VariableNames',{'Monday' 'Tuesday' 'Wednesday'}
'RowNames',{'Senior 1' 'Senior 2'})
Output that i need in attachment.

Answers (2)

Peter Perkins
Peter Perkins on 12 Nov 2015
Abraham, I think what you're looking for is the array2table function.

TastyPastry on 11 Nov 2015
Your data needs to be inputted as columns.
Create variables "Monday", "Tuesday" and "Wednesday" and assign them their data. Then,
rowNames = {'Senior 1','Senior 2'};
t = table(Monday,Tuesday,Wednesday,'RowNames',rowNames);


Community Treasure Hunt

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

Start Hunting!

Translated by