Find with an indexed struc
이전 댓글 표시
I have a struc M whose size is (88,1)
If for instance I type M(46,1).acc I get ans = 0
I typed find(M(:,1).acc==0) to find the rows where the acc field is zero, but got the error Error using == : Too many input arguments.
Any help? Thanks!!
채택된 답변
추가 답변 (1개)
It might not be the most elegant but I think it would solve your problem
Indices = cellfun(@(x) x == 0,struct2cell(M)) % you get a logical array where 0's have an index of 1
there is probably a more clever way to do it though.
댓글 수: 3
AwedBy Matlab
2014년 7월 31일
Ben11
2014년 7월 31일
You're welcome! I prefer Image Analyst's answer though :)
AwedBy Matlab
2014년 8월 1일
카테고리
도움말 센터 및 File Exchange에서 Parametric Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!