If statement
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
for a = [10,110,210]
for b = [1,2,3,4,5,6,7,8,9,10]
c = a + b
end
end
Below these two loops i want to do different processes if b any of these values (1,2,5,6,8) else I will do a different process.
I was thinking an if statement but i dont know how to do this. Please help!
댓글 수: 0
답변 (1개)
  Friedrich
    
 2011년 8월 10일
        Hi,
you can use
if ismember(b,[1,2,5,6,8])
 %b equals one of the number
else
 %do something else
end
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

