I have seen some code that uses:
index = findstr('something', 'longer string');
if ~isempty(index)
% do something
end
I looked up the documentation for MatLab symbols here and it doesn't mention anything about using ~ for converting primitive integer values into boolean. i.e. if index is 10 or if it is [] then isempty will return 0 or 1 which will be converted to 1 or 0 with the ~ operator. However this use case isn't mentioned in the docs. Is this a legitimate way of performing negation. Is there another way of achieving this negation?
Is A==0 really better than ~A?might be relevant.