How to use arguments of other m-file in another m-file?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to use the arguments of the m file called A in the m file called B, but I don't know how.
How can I do?
for example, Use the output values of a1, a2, a3 in the m file called A as the input values in the m file called B.
1 Kommentar
Jan
am 12 Jun. 2022
Please post some code which creates the situation you are asking for. Do you mean scripts or functions?
Antworten (1)
Voss
am 12 Jun. 2022
% get the outputs from A:
[a1,a2,a3] = A(5);
% use them as inputs in B:
result = B(a1,a2,a3)
function [out1,out2,out3] = A(in)
out1 = in;
out2 = in*2;
out3 = in*3;
end
function out = B(in1,in2,in3)
out = in1+in2+in3;
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB 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!