I have an .m file that starts like this:
function [] = foo(n);
if the user calls it like foo(5) in the command window, it’s ok.
But I want the function also run when the user just calls it like foo , without the input n.
I handle this in c++ using the array argv[], is there any way to do this in MATLAB?
thanks for your time..
You can use
narginand related.