Function in Matlab
Mostra commenti meno recenti
Does anybody can tell me plz, how can we see the variables in the workspace when we are using function word in the Editor?
function [h1 h2 h3 h4] = sfighandles;
Cheers
Risposta accettata
Più risposte (1)
Wayne King
il 3 Mag 2012
I'm not exact sure what you are asking, so perhaps you can clarify.
You can declare a variable to be global
>> global X
>> X = randn(10,1);
Then inside a function
function a = testsum
global X
a = sum(X);
end
Note that X is not defined locally inside of testsum.m. I never feel comfortable personally with global variables and just pass what I need to the function.
Categorie
Scopri di più su Programming 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!