Save disp output as a string/cell variable

16 次查看(过去 30 天)
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 中查找有关 Variables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by