access value from another file
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jitesh Bhanushali
am 28 Mär. 2014
Kommentiert: Image Analyst
am 28 Mär. 2014
sir i have 2 m files one is
function mm
r=[1 2 3]
end
saved with name mm.m
the other is
function nn
% some code. I need r!
end
saved with name nn.m
I want to access value of r in file nn.m.
What is statement to access this r???
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 28 Mär. 2014
Have mm.m be this:
function r = mm()
r=[1 2 3]
end
And have nn.m be this:
function nn
% some code.
% Get r from mm():
r = mm;
end
1 Kommentar
Image Analyst
am 28 Mär. 2014
See the FAQ for other methods http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
Weitere Antworten (1)
Wayne King
am 28 Mär. 2014
Why don't you have the function, nn.m, output the value of r, then the function mm can use that value. That is the best way to do it.
Alternatively, look at the help for global
Siehe auch
Kategorien
Mehr zu MATLAB Report Generator finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!