MATLAB: How to get output arguments from a function without calling it (not as ans)

matlab functionworkspace

Hi All, I require the output arguments of a function without calling them from the command line. For example: function is
function [R X Y Z l p] = tplot(i)
Is it possible to get the output (the variables R,X,Y,Z,l,p) in the workspace without calling them? Like instead of using
[R X Y Z l p] = tplot(3);
I just want to use tplot(3). I tried this but it stores the output as 'ans' .
Thanks, Bharat

Best Answer

It can be done by using assignin in the function. It's on par with using global variables, goto, eval, etc. It makes the behaviour of your program a lot more obscure, so best avoided. Saving you from typing a few character is certainly not reason enough.
Related Question