I have tried everything and I have no luck.

조회 수: 1 (최근 30일)
Connor Maddox
Connor Maddox 2016년 10월 4일
편집: Connor Maddox 2016년 10월 5일
fsadf
  댓글 수: 1
James Tursa
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
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
Connor Maddox
Connor Maddox 2016년 10월 4일
I know I do not need a loop to complete the answer but that is what the assignment says to do.
Sima
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by