Check that no input arguments are empty in Matlab

Viewed 483

I have a function with about 10 input arguments. After data processing, these arguments can be empty arrays/vectors. In this event, I would like to set each output to 0 and exit(return) from the function.

How can I do a check to make sure that all inputs to a function are nonempty, without having to type each of them out. I would like something like.

function [outputs1and2] = myfunct(many_arguments)
if isempty(any_input_argument)
    out1 = 0;
    out2 = 0;
    return
end
out1 = some_math;
out2 = more_math;
end
1 Answers
Related