How to increment data steps in a loop?

조회 수: 1 (최근 30일)
Ry
Ry 2014년 2월 14일
답변: Ry 2014년 2월 17일
Hello, I am trying to look at a set of data 7000 entries long and I want to break it into intervals of 30. The first will look at 1-30, next 2-31 and so on. How can I use a "for" or "while" loop to so? I know its all in how I use the conditions, but I have not had any luck so far. Thank you!

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 14일
A=rand(7000,1)
for k=1:7000-30+1
b=A(k:k+29);
% do
end

추가 답변 (1개)

Ry
Ry 2014년 2월 17일
So now that I have it incremented how can I get the out put, b, to show that this is the 400th time through the loop? Can matlab tell me, or do I need to ask matlab?

카테고리

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