Is there a way in Matlab to store command as string for later use?
For example, if I have
x = 1:10;
plot(x, x);
can I somehow store the 2nd row as str = 'plot(1:10, 1:10)' automatically, so later on I can use the command again simply with eval(str)? Any useful functions for helping me with this task?
p.s. I know it's possible to store the line with str='plot(x,x)', but that's not good enough since it depends on instant values of workspace variable x, which can be changed over time.
evalis almost never the right answer. So I agree with @zellus: what are you trying to do?