I have tried everything and I have no luck.
조회 수: 1 (최근 30일)
이전 댓글 표시
fsadf
댓글 수: 1
James Tursa
2016년 10월 4일
Please show what you have done so far, and ask specific questions about where you are having problems.
답변 (1개)
Sima
2016년 10월 4일
What have you tried?
You don't need a loop in Matlab, length(find(X>10)) will give you the number of elements in X that are greater than 10.
disp will display whatever string you give it and mat2str will convert any matrix to a string.
댓글 수: 2
Sima
2016년 10월 4일
it's not as efficient but you can do:
larger_than_ten=0;
for i=1:length(X)
if (X(i)>10)
larger_than_ten=larger_than_ten+1;
end
end
참고 항목
카테고리
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!