Multidimensional Array indexing to a single vector
이전 댓글 표시
I want to check to see if a portion of each column of my array meets a criteria and if it does give a value of 1 and if it doesn't, 0. So x=B(1:5,:)>10 and if B is a 10X10 array, I would like to have x be a 1X10 column vector of ones or zeros. I know this can be done with a loop, but is there anyway to do it without one?
채택된 답변
추가 답변 (1개)
Honglei Chen
2012년 6월 21일
0 개 추천
sum(B(1:5,:)>10)>0
댓글 수: 1
Walter Roberson
2012년 6월 21일
This would be equivalent to the any() code.
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!