find the number of times a pair of value is a struct
Show older comments
Hi, I have a struct of data Clusters3 with dimension [22x1]. I'm interested to find if the pair of value in o (attached)[6 2] are presents in the first two column of Clusters3.users. I want as output a matrix A [22 6] in which is represented for every element of Cluster3 if the six pairs of value in present or no in Clusters3.users
Example
A(1,1) hold the number of times the pair in o(1) is present in Clusters3(1).users(:,1:2);
A(1,2) hold the number of times the pair in o(2) is present in Clusters3(1).users(:,1:2);
A(1,3) hold the number of times the pair in o(3) is present in Clusters3(1).users(:,1:2);
etc
I have tried
for i=1:size(o,1)
c(i)=find (Clusters3(1).users(:,1:2)==o(i))
end
but it gives errors.
I have also try
structfun(@find, Clusters3.users, o(1))
but it doesn't run
Can you help me? thanks
Accepted Answer
More Answers (0)
Categories
Find more on Cell Arrays 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!