Display matrix with row and column labels

Hi all,
Is there a convenient way to display a matrix with row and column labels in the Matlab terminal? Something like this:
In the second row it will calculate x^2+4 also.
I know it is easily can be shown with the code:
x = 1:100;
table = [x; x.^2+4]
But it seems a bit nasty.
I will be happy if you will able to help. Thanks...

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 10일

0 개 추천

Use uitable
x=1:10
M=[x;x.^2+1]
r={'x' 'x^2+1'}
f=figure('position',[100 100 900 200])
t=uitable(f,'data',M,'rowname',r,'position',[0 0 850 200])

댓글 수: 3

Turgut
Turgut 2013년 11월 10일
Thanks for the answer it helped. I would just ask a question. What is the matrices stand for after 'position' in f and t?
Turgut
Turgut 2013년 11월 10일
And can I use the same solution to;
x=1:10
M=[x;x.^2+1]'
r={'x' 'x^2+1'}
f=figure('position',[400 400 300 500])
t=uitable(f,'data',M,'columnname',r,'position',[0 0 250 500])

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

질문:

2013년 11월 10일

댓글:

2013년 11월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by