How to use one function in another function
Mostrar comentarios más antiguos
If I have a function f1 defined in a f1.m file and another f2 in f2.m, how to use these two functions in another function definition f3 in f3.m? And How do I use variables created/ used in the f1 and f2 files, in the f3 function?
Respuesta aceptada
Más respuestas (1)
KSSV
el 28 de Jul. de 2020
Easy save all the functions in same folder and run.
function val = TwoSum(a,b)
val = a+b;
end
function val = ThreeSum(a,b,c)
val = a+b+c ;
end
function out = Check(a,b,c)
sum1 = TwoSum(a,b) ;
sum2 = ThreeSum(a,b,c) ;
out = sum1+sum2 ;
end
Categorías
Más información sobre Entering Commands en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!