Function in Matlab
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (1)
Wayne King
el 3 de Mayo de 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.
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!