Is there a way to save a variable created in a function to the workspace?
140 views (last 30 days)
Oleg Komarov on 19 Mar 2012
the syntax of a function could be summarized as:
[output1, output2, ...] = function(input1, input2, ...)
Say, yuor variable is named X in the function, then all you need to do is:
X = function(...)
If you call the function as:
your variable will be assigned automatically to ans, otherwise to
anyname = function(...)
anyname will be what is X in your function.
As Aldin pointed out, if you're in a GUI then use: