tags:

views:

42

answers:

2

Both functions disp and display do not have return parameters and display variable content into command window.

I would like to get the result of function call (displayed string) into a variable instead of output into command window, something like this str = ToString( myStruct ); where input variable is a MATLAB struct!

I am aware that display result depends on available width of command window, it can be either wide or narrow.

In all modern programming languages it would be a obj.ToString() method.

+1  A: 

struct2str might be a solution for your problem.

zellus
+1 but I think there is also a general solution, not only for structs.
Mikhail
+7  A: 

toString = @(x) evalc('disp(x)')

Not pretty, but it should get the job done.

Edric

related questions