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 日

0 投票

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

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

タグ

質問済み:

2016 年 10 月 4 日

編集済み:

2016 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by