Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to sum up a series based on a defined interval
Date: Tue, 3 Feb 2009 17:00:18 +0000 (UTC)
Organization: CSU
Lines: 29
Message-ID: <gm9t72$1u6$1@fred.mathworks.com>
References: <gm7u8q$hom$1@fred.mathworks.com> <gm7v8l$ohq$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233680418 1990 172.30.248.37 (3 Feb 2009 17:00:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 3 Feb 2009 17:00:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 951788
Xref: news.mathworks.com comp.soft-sys.matlab:515744


The length of dailyflux is <3288x1>.

I know I probably mixed up in the length of matrix for mat2cell, but I cannot figure it out how to modify my code.

Will you please give me a hint?
Thanks,
Michael

%%%%%%%%
??? Error using ==> mat2cell at 116
Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [3288
1].

%%%%%%%%
dailyflux_NT=CO2resp_daily_NT_m2
for Year = 2000:2007
days_per_weird_week=[]
    for n = 1:12
        days_per_weird_week = [days_per_weird_week ; 7 ; 7 ; 7 ; 7; rem(eomday(Year, n), 7) ]
    end
end

    ind = find(days_per_weird_week ~= 0)
    days_per_weird_week = days_per_weird_week(ind)
    
    for n = 1:length(days_per_weird_week)
        dailyflux_NT(n)=sum{mat2cell(dailyflux_NT,days_per_weird_week)}
        dailyflux_NT = [dailyflux_NT ; dailyflux_NT(n) / days_per_weird_week(n) * ones(days_per_weird_week(n), 1)]
    end