MATLAB: Can i call a parent function in a seperate .m file

call a parent function in a seperate .m file ?

I have created a nested function. Moreover, i have created a seperate .m file. i need to call the parent function in which my whole parent function with its child functions has to be run. Is it possible ?
Thanks in advance for your kind help.

Best Answer

  • Yes, It will work. If the parent function (top-level function) is saved as an .m file, you just need to call the parent function, and all the child (nested) functions will be automatically executed. Read about the nested function here: https://www.mathworks.com/help/matlab/matlab_prog/nested-functions.html