how to write a code in which the output of a one function will be out put to an other function.?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have created 5 functions in different m files. v=[1,2,4,3,5]% if the function execution order, in this case, the output of function will be the input to the function 2 and output of the function 2 will be input to the function 4 and function 4 output will be input to the function 3 and so on, in the end, the final output
0 commentaires
Réponses (1)
Stephen23
le 14 Août 2018
Modifié(e) : Stephen23
le 14 Août 2018
This is easy, assuming that each function has just one input and output. Try this:
C = {@fun1,@fun2,@fun3,@fun4,@fun5}; % cell array of function handles.
val = []; % initial value.
for k = [1,2,4,3,5] % the order to call the functions in.
val = C{k}(val);
end
0 commentaires
Voir également
Catégories
En savoir plus sur Logical 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!