The command disp(x) does a reasonable job of displaying variables of any class. For example, it expands structures to show their fields and values. Is it possible to capture this formatted output as a variable?

 채택된 답변

Paulo Silva
Paulo Silva 2011년 5월 6일

8 개 추천

MyVariable=evalc('disp(MyThingToShow)')

댓글 수: 2

Daniel Shub
Daniel Shub 2011년 5월 6일
Look at that, there is a use for eval (well evalc ...).
Paulo Silva
Paulo Silva 2011년 5월 6일
the spy function without arguments is better :)

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

추가 답변 (2개)

Jan
Jan 2021년 7월 28일

4 개 추천

Since Matlab R2021a:
str = formattedDisplayText(x)
Manish Vankudre
Manish Vankudre 2018년 3월 13일

0 개 추천

Can you please give an example an explain

카테고리

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

질문:

2011년 5월 6일

답변:

Jan
2021년 7월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by