MATLAB: How to return no output in a function with output

MATLABnooutput

I have a function which should return two outputs, but if a condition is satisfied (in my case if a matrix is singular) it is no posible to calculate any output but the function returns the outputs. I would like to know if there is any posibility in order to return no output. This is my function:
function [x, NumIter] = Newton(fun, Jfun, x0, tol, IterMax)
x = x0;
NumIter = 0;
funx = fun(x);
Jfunx = Jfun(x);
if rank(Jfunx)<length(Jfunx)
disp('The matrix is singular')
return
end
...
end
In this case, if the matrix is singular, the function returns the initial x and the initial number of iterations. Would be possible not to return them?
THANK YOU SO MUCH !!

Best Answer

You MUST return something or else you'll get an error. And it's good that you defined them to be something in the very first lines of the function (most people mistakenly do not).
However, if you want, you can return null.
x = [];
NumIter = [];
disp('The matrix is singular')
return
just be sure to examine what's returned, null or actual data, when you call the function from your main program.