MATLAB: Opérateur ~= dans une assignation

~=

Bonjour !
J'ai vu dans un code dont j'ai besoin:
enc = enc + (k(i,j) ~= k(i-1,j))
Je me demande ce que fait l'opérateur ~= dans un calcul et non dans un booléen… Pouvez vous m'aider ?

Best Answer

The comparison by ~= replies a logical array. If two arrays are added, the classes of the operands determine the class of the result:
b = (1 ~= 0); % LOGICAL
a = 2 + b % 3 as DOUBLE
uint(2) + b % error integertypes of different class
single(2) + 1 % 3 as SINGLE
If you add a logical to a floating point type, it is converted to 1.0 or 0.0.