Save disp output as a string/cell variable

조회 수: 44 (최근 30일)
Daniel Shub
Daniel Shub 2011년 5월 6일
답변: Jan 2021년 7월 28일
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일
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일
Since Matlab R2021a:
str = formattedDisplayText(x)

Manish Vankudre
Manish Vankudre 2018년 3월 13일
Can you please give an example an explain

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by