in the following code I need subtract the values 255 and 254 by 1
and adding the value 0 and 1 by 1 and the other values don't change
X=[255 250 0 100 38 47 150 254 253 251 250 0 0 47 25 252 0 0 0 90 145 74 30 249 200 220 0 1 2 3 225 4 0 255 251 0 4 20 35 245 255 250 0 100 38 47 150 254 200 220 0 1 2 3 225 4 253 251 250 0 0 47 25 252]; Max = 255; Min = 0; [x,y] = size(X); for i= 1:x for j = 1:y if X(i,j)==(Max | Max-1) X1(i,j) = X(i,j)-1; elseif X(i,j)== (Min | Min+1) X1(i,j) = X(i,j)+1; else X1(i,j)= X(i,j); end end end
**************************************
but resultes not change:it give me
X1=[255 250 0 100 38 47 150 254 253 251 250 0 0 47 25 252 0 0 0 90 145 74 30 249 200 220 0 1 2 3 225 4 0 255 251 0 4 20 35 245 255 250 0 100 38 47 150 254 200 220 0 1 2 3 225 4 253 251 250 0 0 47 25 252];
Please….I need know what error in the code
Best Answer