Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: how to sum up a series based on a defined interval
Date: Mon, 2 Feb 2009 23:06:02 +0000 (UTC)
Organization: CSU
Lines: 22
Message-ID: <gm7u8q$hom$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233615962 18198 172.30.248.35 (2 Feb 2009 23:06:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 2 Feb 2009 23:06:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 951788
Xref: news.mathworks.com comp.soft-sys.matlab:515532


Dear all,

There is a series called "value" and it needs to be sum up based on an interval as below and then print out a new series.
>> value = [1;2;3;4;NaN;6;7;8;9;NaN;11;12;13;NaN;15;16;17;18;19;20;21;22;23;24;25;26;NaN;28;29;30;31]
>> interval=[4;3;4;3;4;3;4;3;3]

For example,
[1;2;3;4] for the 1st accumulation based on the 1st value [4] of interval matrix
[NaN;6;7] for the 2nd accumulation based on the 2nd value [3] of interval matrix
[8;9;NaN;11] for the 3rd accumulation based on the 3rd value [4] of interval matrix
[12;13;NaN] for the 4th accumulation based on the 4th value [3] of interval matrix
:
:
[25;26;NaN;28] for the 8th accumulation based on the 8th value [3] of interval matrix
[29;30;31] for the 9th accumulation based on the 9th value [3] of interval matrix

>> output = a new series after the each accumulations.


Please advice me. Thank you.

Michael