Displaying a Matrix in Long Format

I have a matrix that is 5x3. I would like to display this matrix in long format, but I can't figure out how to do this.
disp(A) just displays 4 decimal points
Everything else I have tried is an error. Such as:
format long disp(A)
disp(format long (A))
etc.
I tried to accomplish this when building the matrix, too:
format long x = function(whatever)
A(i,j) = x
But this errors out too.
I'm at a loss. Can anyone help? Thanks.

댓글 수: 1

Daniel Shub
Daniel Shub 2012년 9월 24일
I think this would be a nice enhancement to disp. Something like disp(A, 'Long') seems to me to be reasonable.

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

 채택된 답변

bym
bym 2012년 9월 24일

0 개 추천

try separating the 'format long' from the rest of your code perhaps this will help
format long;
>> rand(3,4)
ans =
0.814723686393179 0.913375856139019 0.278498218867048 0.964888535199277
0.905791937075619 0.632359246225410 0.546881519204984 0.157613081677548
0.126986816293506 0.097540404999410 0.957506835434298 0.970592781760616

댓글 수: 1

Alex
Alex 2012년 9월 24일
That did it. Thank you. I would never have figured that out.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2012년 9월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by