How can I check if a condition holds?
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
I want to find the elements where the following condition holds: 0<x and y=1.
x and y are arrays. How can I find the rows where both conditions hold at the same time?
댓글 수: 0
답변 (1개)
  Image Analyst
      
      
 2018년 6월 5일
        
      편집: Image Analyst
      
      
 2018년 6월 5일
  
      You can say this:
indexes = (x > 0) & (y == 1)
outputArray = inputArray(indexes);
What shape are your x, y, and input array? 1-D vector? 2-D matrix?
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

