Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how to do a loop for a number to determine what color to use?
조회 수: 1 (최근 30일)
이전 댓글 표시
theta=zeros(N,N);
theta = mod(bsxfun(@plus, (1:N), (1:N).'),2);
In this case, N is the input that the user chooses. At this point it gives me a matrix theta=[0,1,0,1 ; 1,0,1,0 ; 0,1,0,1 ; 1,0,1,0] and I was wondering how I could do a loop so that when theta=0 it will use color1 and when theta=1 it will use color2. (in this case, color1 and 2 are also inputted by the user)
댓글 수: 0
답변 (1개)
Image Analyst
2016년 11월 20일
Try this inside your loop:
if theta(row, column) == 0
colorToUse = color1;
else
colorToUse = color2;
end
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!