The following info might be obvious to you!
Well, you know usually in matlab, each function has to be declared into a separate fun_name.m file. In this case the objective is to allow other scripts to call this function.
But, if I need a function to be used inside a function which does not need to be called from the outside then how to do that?
It's damn obvious but I needed some time to figure it out :-)
function return_val=function_to_be_called (parameters of function_to_be_called )
% main code for function_to_be_called
% Here You may call internal_function
function val=internal_function (parameters of internal_function )
% your code
end % end of internal_function
end % end of function_to_be_called
Well, you know usually in matlab, each function has to be declared into a separate fun_name.m file. In this case the objective is to allow other scripts to call this function.
But, if I need a function to be used inside a function which does not need to be called from the outside then how to do that?
It's damn obvious but I needed some time to figure it out :-)
function return_val=function_to_be_called (parameters of function_to_be_called )
% main code for function_to_be_called
% Here You may call internal_function
function val=internal_function (parameters of internal_function )
% your code
end % end of internal_function
end % end of function_to_be_called
No comments:
Post a Comment
Please ask if anything is not clear enough..........