How to form a matrix ?

조회 수: 1 (최근 30일)
VIJAY
VIJAY 2019년 9월 18일
편집: KALYAN ACHARJYA 2019년 9월 18일
name=['ajay;sekar;tom] have scor the mark1 is[20;30;40]; and also mark2 is[25;35;45]; and also mark3 is[23;33;43]; i want to display as follow
name mark1 mark2 mark3
ajay 20 25 23
sekar 30 35 33
tom 40 45 43
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 9월 18일
The easiest is to loop using fprintf() for each line.
It is possible to print it all out in one command, but the code is not as clear.

댓글을 달려면 로그인하십시오.

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 9월 18일
편집: KALYAN ACHARJYA 2019년 9월 18일
name= {'Ajay';'Sekhar';'Tom'}
mark1=[20;30;40];
mark2=[25;35;45];
mark3=[23;33;43];
Varibles_Names={'Name', 'Mark1', 'Mark2', 'Mark3'};
T = table(name,mark1,mark2,mark3, 'VariableNames',Varibles_Names)
Result:
3×4 table
Name Mark1 Mark2 Mark3
________ _____ _____ _____
'Ajay' 20 25 23
'Sekhar' 30 35 33
'Tom' 40 45 43
Other way:
As suggested by @Walter using fprintf

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by