Setting a counter to save values in a for loop
4 views (last 30 days)
Show older comments
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 Comment
Stephen23
on 22 Feb 2016
Edited: Stephen23
on 22 Feb 2016
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.
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!