Error in displaying output
조회 수: 8 (최근 30일)
이전 댓글 표시
I have posted code below
A=[1;2;3;4;0;0;0;0]
for i=1:size(A)
if A(i)==0
A1= 'good'
else
A1= 'bad'
end
end
the output i get is
A1=bad
A1=bad
;
;
;
;
;A1=good
but i need to be dispalyed as
bad
bad
;
;
;
good
i know it is simple ,i tried but could not get the answer..plase help
댓글 수: 0
채택된 답변
Grzegorz Knor
2011년 11월 3일
A=[1;2;3;4;0;0;0;0];
for i=1:size(A)
if A(i)==0
A1= 'good';
else
A1= 'bad';
end
disp(A1)
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Engines & Motors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!