Save disp output as a string/cell variable

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 ExchangeVariables についてさらに検索

質問済み:

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