Setting a counter to save values in a for loop
4 次查看(过去 30 天)
显示 更早的评论
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
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 Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!