How to check for condition without using a loop or if statement.

The problem set up is this: Given vector A, and the average value of the elements in vector A, track the number of times an element in vector A is greater than the average value of elements in A.
The issue is that I'm not allowed to use a loop or and if statement.

回答 (1 件)

Image Analyst
Image Analyst 2018 年 10 月 19 日

0 投票

Since it's homework, we can't give you the answer outright. So read this link: http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers
Hint: use mean(), the greater than symbol, and sum().

カテゴリ

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

タグ

質問済み:

2018 年 10 月 19 日

回答済み:

2018 年 10 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by