find the rank of an element in a vector in matlab -


i have task combine 2 vectors in following way. input 2 vectors first 1 indicating indices of dividors of groups , second 1 indicating elements trying classify. example, vector [1,3,5,9] means first group consists of 1, second group consists of 2 , 3, third group consists of 4 , 5, , forth 1 consists of 6, 7, 8 , 9, etc. in case, if second vector [2,4,6], output [2,3,4].
know how impliment in matlab loops. question is: there anyway without loops? many time , attentions.

edit:

scalevtr=[1,3,5,9]; >> eltvtr=[2,4,6]; >> j=1; output=[]; >> i=1:size(eltvtr,2)       while(true)         if eltvtr(i)<=scalevtr(j)            output= [output,j];            break;         else j=j+1;         end       end    end >> output  output =       2     3     4 

qq = [1 3 5 9];  qq2 = [2 4 6]; ceil(interp1(qq,1:numel(qq),qq2)) 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -