how to use the output of a user defined function as the input of another user defined function?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Suresh R
am 11 Nov. 2021
Kommentiert: Suresh R
am 11 Nov. 2021
how to use the output of a user defined function as the input of another user defined function?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 11 Nov. 2021
Example
x = 13.5
my_cube_root(twice(x))
function r = my_cube_root(v)
r = nthroot(v, 3);
end
function r = twice(v)
r = 2*v;
end
The output of the user-defined function twice is used as the input to the user-defined function my_cube_root
Weitere Antworten (1)
Awais Saeed
am 11 Nov. 2021
num = 1:10;
[S] = Addition(num)
[M] = multiply(S) % pass output of function 1 as input to function 2
% function 1
function [S] = Addition(num)
S = sum(num);
end
% function 2
function [M] = multiply(S)
M = S*5;
end
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!