Finding remaining numbers in logical indexing?
이전 댓글 표시
How would you find how many numbers in an array do not meet any of the previous conditions without using else if statements?
I want to return all the numbers that do not meet the previous conditions listed, but I can't figure out how to do that without using if else statements.
find=length<1;
disp('stubby')
sum(find(:) == 1)
find=(length < 3) & (max_width_head > mean_width_neck*2);
disp('mushroom')
sum(find(:) == 1)
find=max_width_head>=mean_width_neck;
disp('long thin')
sum(find(:) == 1)
댓글 수: 2
James Tursa
2019년 5월 14일
You are really going to confuse your readers by using the names "find" and "length" as variable names ... they shadow important MATLAB functions. I would advise using different names.
madhan ravi
2019년 5월 14일
편집: madhan ravi
2019년 5월 14일
First and foremost your variable naming is totally a bad idea and second of all what is the input and what output are you expecting?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!