how to make a table from matrix data?

2 ビュー (過去 30 日間)
Abraham Chan
Abraham Chan 2015 年 11 月 11 日
回答済み: Peter Perkins 2015 年 11 月 12 日
'beginner in Matlab'
example
A=[1,2,3;4,5,6];
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,...
'VariableNames',{day},...
'RowNames',{name})
I dont want to type one by one into the code.
example
T =table(matrix,...
'VariableNames',{'Monday' 'Tuesday' 'Wednesday'}
'RowNames',{'Senior 1' 'Senior 2'})
Output that i need in attachment.

回答 (2 件)

Peter Perkins
Peter Perkins 2015 年 11 月 12 日
Abraham, I think what you're looking for is the array2table function.

TastyPastry
TastyPastry 2015 年 11 月 11 日
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);

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by