In Matlab, you can evaluate an arbitrary string as code using a function eval. For example.
s = '{1, 2, ''hello''}' % char
c = eval(s) % cell
Is there a way to do the reverse operation; getting a string representation of an arbitrary variable? That is, recover sfrom c? Sort of
s = repr(c)
Such a function repris built into Python, but I have not seen anything like it in Matlab and I do not see a clear way to implement it.
The closest thing that I know of is similar to disp(c)that which prints the presentation c, but in a “readable” format, not in a literal format.
source
share