MATLAB: How to call a function m-file within another m-file

for loopfunction

How can I call a separate function m-file within a for-loop of another m-file? Both are saved in the same path.

Best Answer

Just call that function. If you have a function called myfun defined in myfun.m, you can call it anywhere in another m file.
a=1;
for k=1:3
myfun;
end