Hello, I try to well explain my problem… I have an array A(200×14) in which all the rows show 14 values for each observation period. I need to create another matrix B in which, for each row, the values need to be 1 if it is the maximum value, -1 if it is the min and 0 otherwise. I try to explain better, for example, if in A, in the first row, the values are: [0.5 1 3 4.6 2.8 3.4 6.7 0.01 2.3 8.4 5.1 7.3 1.8 4.3] in matrix B the values should be [0 0 0 0 0 0 0 -1 0 1 0 0 0 0] and I have to make this for each row (considering that the values in the A rows are not the same for each row). Is it possible?Can someone explain me how? I have tried with if,elseif else…but I think there is something that does not work. THANKS
MATLAB: Create a new matrix with 0,-1 and 1 if and where in another matrix appears a max value
if statement
Best Answer