MATLAB: Decrease the least and increase the highest

arraydecreasedivideincreasemultiplysign

I have an array
A = [1 -3 -6 10 2 3 7 -1 -9 -3]
B = [1 2 3 4 5 6 7 8 9 10]
1) I want to check the least negative and the highest positive in array A.
2) In the corresponding number in Matrix B, if it is the least negative then multiply the number in B by 10 and if it is the highest positive, then multiply the number in B by 100.
3) Then B = [1 2 3 400 5 6 7 8 90 10]

Best Answer

A = [1 -3 -6 10 2 3 7 -1 -9 -3];
B = [1 2 3 4 5 6 7 8 9 10];
[~,idxlo] = min(A);
[~,idxhi] = max(A);
B(idxlo) = 10*B(idxlo);
B(idxhi) = 100*B(idxhi)
B =
1 2 3 400 5 6 7 8 90 10