フィルターのクリア

For-end statements

1 回表示 (過去 30 日間)
Noah Kebschull
Noah Kebschull 2017 年 11 月 19 日
回答済み: Walter Roberson 2017 年 11 月 19 日
I have a row vector v of randomly generated numbers. I need to create a for-end statement using a looped variable, k, that will be assigned to every element of the row vector whose elements represent the positions of the row vector. I need to find the number of negative elements in the vector, number of positive elements, the sum of all elements, and the product range of all real numbers all within the for-end. I've started with naming and defining my variables, but I can't seem to figure out how to start the for-end statement.

採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 19 日
for K = 1 : length(v)
total = total + v(K);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by