I have a quick question: Suppose there are two vectors A(m,1) and C=zeros(m,1). Now I want to replace the element of C with one if it is at the position of the maximum value of the first N elements of A. And so on. To clarify here is an example:
A = [2 4 5 1 8 9]; N = 2; than C should be: C = [0 1 (as 4>2) 1 0 (as 5>1) 0 1 (as 9>8)]; My issue is, I need to do this using as few computational power as possible as it will be part of a Monte Carlo study.
Cheers and thank you in advance!