I have a 67*1 matrix of 1's and 0. I want that if variable = 1, it should display 'good' else 'nothing'.
조회 수: 1 (최근 30일)
이전 댓글 표시
a = 1 0 0 0 0 0 0 1 0 and so on.
댓글 수: 0
채택된 답변
Image Analyst
2017년 4월 16일
Try this:
for k = 1 : length(a)
if a(k) == 1
fprintf('a(%d) = good\n', k);
else
fprintf('a(%d) = nothing\n', k);
end
end
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!