Ro =
1 1 1 1
0 1 0 1
1 0 0 0
1 1 0 1
1 0 0 0
Given an arbitart matrix like this such that for every row in Ro crossponds a rank in ranks:
I need to extract all the rows in Ro that crossponds to ranks=3 but I need some general rule because the matrices Ro and ranks changes in the code
I thought of the following:
I made a function:
function [ pos ] = Position( x,n )
pos=find(x==n);
end
FF=[];
P=Position(ranks,3);
lenP=length(P);
for i=1:lenP
FF=[FF;Ro(P(i),1:end)]
end
The problem is that FF=[1 0 0 0; 1 0 0 0];
I need it only be FF=[ 1 0 0 0]; I don't want repition
so can you help :)?