Save disp output as a string/cell variable

38 visualizaciones (últimos 30 días)
Daniel Shub
Daniel Shub el 6 de Mayo de 2011
Respondida: Jan el 28 de Jul. de 2021
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?

Respuesta aceptada

Paulo Silva
Paulo Silva el 6 de Mayo de 2011
MyVariable=evalc('disp(MyThingToShow)')
  2 comentarios
Daniel Shub
Daniel Shub el 6 de Mayo de 2011
Look at that, there is a use for eval (well evalc ...).
Paulo Silva
Paulo Silva el 6 de Mayo de 2011
the spy function without arguments is better :)

Iniciar sesión para comentar.

Más respuestas (2)

Jan
Jan el 28 de Jul. de 2021
Since Matlab R2021a:
str = formattedDisplayText(x)

Manish Vankudre
Manish Vankudre el 13 de Mzo. de 2018
Can you please give an example an explain

Categorías

Más información sobre Performance and Memory en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by