function can not retrive varaible value from other function
Afficher commentaires plus anciens
i have have generated two functions. function 2 can not pick the variable value, generated in function one,
what is the solution to utilize the variable value generated in function 1?
1 commentaire
Réponses (2)
Julia
le 24 Juil 2014
I do not understand your code.
What should work to let the second function use the first:
ans=function2(function1(input))
Peter Babu
le 24 Juil 2014
Make the variable to global. Check the below code.
function 1() global x; x = 10; x = x+10
return
function 2() global x; global y; y = 0; y = y+20; display(x); return
function test() global x; global y;
display(x);
display(y);
return
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!