I am writing a solution in which I need to check if an array contains any NaN values. If it does NOT, then I can go ahead and run a function on the data. This is my current solution:
if find(isnan(inputData))
% Nothing goes here since I only want the function to run if the 'if' statement fails
else
doFunction(inputData);
end
Is there an elegant way of negating the ‘if’ statement; thus avoiding the empty first clause?
Is that elegant enough for you ? If not, how do you like this ?