How can I use one variable between two function ?
20 views (last 30 days)
Mischa Kim on 28 Feb 2014
Edited: Mischa Kim on 28 Feb 2014
Dipten, you can simply pass those variables as input and output parameters between your functions. E.g.
function val1 = my_fun1(inp1)
inp = ...
v2 = my_fun2(inp); % call my_fun2 with parameter inp
function val2 = my_fun2(inp2) % in this case inp2 = inp
... % do some computations
val2 = ... % and return val2 to the calling function