How to use for loop to count?
이전 댓글 표시
I have a list of patients, and want to use a for loop to count how many of them are over the age of 12. Very new to loops - any type of help would be appreciated!
patient_ages = [15 8 6 12 16 3 18 12 13 9 8 15 5 2]
over12 = 0
for i=1:length(patient_ages)
if patient_ages > 12
over12 = over12 +1
end
end
return over12
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 PID Controller Tuning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!