find is working in strange way
2 views (last 30 days)
Show older comments
ahmed shaaban
on 20 Mar 2014
Commented: ahmed shaaban
on 20 Mar 2014
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
0 Comments
Accepted Answer
Sean de Wolski
on 20 Mar 2014
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
6 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!