I have a column of years-month (i.e. janurary of 1960= 196001), and of the data for that year. I need to create a loop to calcuate the anual rate of change from month to month. This means if I am starting with 196001 I need to up six months to 19607 grab that value, then subtract that from the value of 195907. Is there a index code that grabs the value of 6 above and 6 below of your original index.

댓글 수: 3

Bob Thompson
Bob Thompson 2019년 2월 6일
You might have some luck working with datetime(), but other than that you will likely have to do your own indexing. Generally, indexing above or below by six would be simply adding or subtracting six from your index.
subset = data(i-6:i+6,:);
Andrei Bobrov
Andrei Bobrov 2019년 2월 6일
Please attach small example your data as mat-file.
Michael Lauria
Michael Lauria 2019년 2월 6일
Attatched is an example file

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2019년 2월 6일

댓글:

2019년 2월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by