The tilde character (~) is generally used as the bitwise NOT operator.
As the ! character is reserved for an other usage (OS command), I guess it's not a bad choice.
Videos
In the workspace, enter
doc not
or
doc ~
You will have an answer from the documentation of Matlab.
This use case is mentioned in the docs exactly where your link points to (see "Not Equal To" and "Logical NOT" under "Tilde -- ~"). You can also enter help ~ in the MATLAB console and get an explanation about usage.
This is the legitimate way of performing negation of a boolean. You can apply it to 0 and 1 to flip them, but it will also treat any non-zero value as a 1.
Another way to perform negation of x would be x = 1 - x, but that only works if x is boolean. So for the code you posted, you could do this:
index = findstr('something', 'longer string');
if 1 - isempty(index)
% do something
end
EE junior here, so since i got into my uni and i have been hearing a lot of engineering students talking about matlab, at first i thought it was an app for material stimulation (mat = material), but as i search more about it the more confused i am like it looks like a programming language but why does it need it's own app why is there a lot of extra stuff.
Please explain to me as your little brother, sorry for the hassle :')
The single ampersand & is the logical AND operator. The double ampersand && is again a logical AND operator that employs short-circuiting behaviour. Short-circuiting just means the second operand (right hand side) is evaluated only when the result is not fully determined by the first operand (left hand side)
A & B (A and B are evaluated)
A && B (B is only evaluated if A is true)
&& and || take scalar inputs and short-circuit always. | and & take array inputs and short-circuit only in if/while statements. For assignment, the latter do not short-circuit.
See these doc pages for more information.