How to use a function output in another function?
Mostra commenti meno recenti
I have written a function in the script, say
function A = matrixy()
A = zeros(3);
end
When calling it in the command window, I'll have
>>matrixy
ans =
0 0 0
0 0 0
0 0 0
But when I key in A in the command window, it shows "Undefined function or variable 'A'". Is there a way to let A pick up this value in the command window?
Also, I want to create another function and use this matrix A produced in the previous function. How should I do it?
Many thx!
1 Commento
How to assign output arguments to variables is also covered in the introductory tutorials:
Doing the introductory tutorials teaches lots of these basic concepts, which saves time in the long run.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Descriptive Statistics and Visualization in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!