Save disp output as a string/cell variable

16 ビュー (過去 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 Center および File ExchangeVariables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by