MATLAB: Find is working in strange way

find

Hello I am trying to use the find to find number in array greater than 0.6 , but the behavior is strange
cluster_map=zeros(21,14);
[r c]=find(field>=0.6)
the length of the r is 20
cluster_map(r,c)=2;
[rr cc]=find(cluster_map == 2);
the length of rr is 40 !!! how this happen. I have attached the field array. thanks in advance

Best Answer

r = [1 5 8]
c = [2 3 6]
x = zeros(10)
x(r,c) = 1
I'd guess what you want is to use sub2ind to use each combo of r and c once
x = zeros(10);
x(sub2ind(size(x),r,c)) = 1