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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by