Setting a counter to save values in a for loop

4 ビュー (過去 30 日間)
Om
Om 2016 年 2 月 22 日
編集済み: Stephen23 2016 年 2 月 22 日
Hi all I have a for loop running 1:100:10,
It is calculating a mean on a graph using:
data_meanD1=mean(r(ix,:))
data_meanD2=mean(r(~ix,:))
This is giving me only the average value of one of the means in my workspace.
I wanted to set up a counter to save all 10 mean values outputted on the 10 graphs I am getting, any tips please?
  1 件のコメント
Stephen23
Stephen23 2016 年 2 月 22 日
編集済み: Stephen23 2016 年 2 月 22 日
Perhaps you need to review your loop variable, which you specify as 1:100:10. In MATLAB this means "start from one, steps of one hundred until end at ten". This returns just one value! Check out the difference:
>> 1:100:10
ans = 1
>> 1:10:100
ans =
1 11 21 31 41 51 61 71 81 91
Please show us your complete code.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by