I'm trying to replace the values in array1 following this Logic:
- If the values are greater than one use just the decimal value.
- If it's exactly 1 stay at 1
- If 0 stay 0
- If neg make positive and follow the logic
The code I used was:
array1=[0.5 1.3 1.0 0.0 -0.2 -2.78]
array1(array1>1)=mod(abs(array1),1)
what I expected to get is array1 = [0.5 0.3 1.0 0.0 0.2 0.78]
But I get an error: =: nonconformant arguments (op1 is 1x1, op2 is 1x5) how can I fix this?
PS: I'm using Octave 5.2 which is similar to Matlab