MATLAB: What does A(~A) mean

tilde

Hi
could someone tell me what does following code mean please?
A(~A)=inf; %A is a vector with zero and non-zero numbers.
Best,

Best Answer

It works out the same as
A(A~=0) =inf
Which is to say that it replaces all nonzero entries with infinity.
Related Question