Function in Matlab
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Wayne King
le 3 Mai 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.
Catégories
En savoir plus sur Programming 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!