how to see a variable of a function in the Workspace?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Rightia Rollmann
le 14 Août 2016
Modifié(e) : Stephen23
le 14 Août 2016
How to see a variable of a function in the Workspace?
4 commentaires
Azzi Abdelmalek
le 14 Août 2016
function out_1 = test( in_1 )
global internal
out_1 = in_1 + 1;
internal = [ 1 2 ];
Save this function as test.m then in Matlab Windows command type
global internal
in_1=10 % set a value to in_1
out_1 = test( in_1 )
internal
Stephen23
le 14 Août 2016
Modifié(e) : Stephen23
le 14 Août 2016
@Rightia Rollmann: rather than learning bad programming practices (using globals), you should simply learn to use the debugging tools, or passing variables properly.
Réponse acceptée
Azzi Abdelmalek
le 14 Août 2016
function y=som(x,y,z)
global a b
a=x*y
b=y^z
y=a+b
When you call the function som
global a b
y=som(1,2,3)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Variables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!