call a function within another function

Plus de réponses (4)

Abhishek M
Abhishek M le 1 Avr 2014

1 vote

Hi,
What I understood is that you are trying to call a m-file through another m-file, if that's what you are trying, then place both the files in the same path and try calling with the same name given for the secondary m-file in the code of the primary m-file.
Dishant Arora
Dishant Arora le 1 Avr 2014
fucnction functionFileName1()
% Code
functionFileName2; % Another function you want to call
end
Chandrasekhar
Chandrasekhar le 1 Avr 2014
I guess you want to have two function within same m file.
function fun_one()
fun_two();%this is another function
function fun_two()
%function body here
ragesh r menon
ragesh r menon le 1 Avr 2014

0 votes

You can use function handles for this. The task is to create a handle of the function you want to call and pass this to the other function. A tutorial is given in the the following link : Applications of Function Handles

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by