call a function within another function

3 次查看(过去 30 天)
How to call a m file(this is also one function) within another function

采纳的回答

nl2605
nl2605 2014-4-1

更多回答(4 个)

Abhishek M
Abhishek M 2014-4-1
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 2014-4-1
fucnction functionFileName1()
% Code
functionFileName2; % Another function you want to call
end

Chandrasekhar
Chandrasekhar 2014-4-1
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 2014-4-1
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

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by