I want to write a function that return four different variables. I wrote a smfunctionof.m
file with heading
function [a,b,c,d]=smfunctionof(x)
where x is a size 20 vectorand under the body I have something like
a=x.^2;
b=x.^4;
c=x.^10;
d=x.^12;
Now, in the code script, I want access those variables. When I type smfunctionof(x)
, I recieve an answer (that returns, if I remember correctly, a=x.^2
or something). But when I continue and write a code something like a;
or even sqrt(a)
, it does not return it. How can I make a variable from a function usable, or exactly, how do I use variables in function in main script? I have already included those in arguments.