Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Data Subsampling
Date: Tue, 23 Nov 2010 21:09:04 +0000 (UTC)
Organization: Univ of Otago
Lines: 20
Message-ID: <ichahg$c5u$1@fred.mathworks.com>
References: <ich2vm$mbl$1@fred.mathworks.com> <ich5cg$22r$1@fred.mathworks.com> <ich6cc$6j9$1@fred.mathworks.com> <ich6v4$flh$1@fred.mathworks.com> <ich8c4$if5$1@fred.mathworks.com> <ich8p9$fgj$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1290546544 12478 172.30.248.38 (23 Nov 2010 21:09:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 23 Nov 2010 21:09:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1397359
Xref: news.mathworks.com comp.soft-sys.matlab:689459

"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ich8p9$fgj$1@fred.mathworks.com>...
> 
> > > data(:,1) = data(:,1)-min(data(:,1))+1; %normalize so 1974 is 1
> > > 
> > > new_data_matrix = accumarray(data(:,[1 2]),data(:,3));
> > > 
> > > each row of the new matrix will be the year (1:37) and the columns will be the 366 days.
> > > 
> > > You could also do:
> > > new_data_matrix = zeros(37,366);
> > > new_data_matrix(sub2ind([37 366],data(:,1),data(:,2))) = data(:,3);
> > 
> > Thanks Sean - what I get with the first approach is a matrix of zeros from Row 0 to 1973  by 366 columns and then the data appears. Is there a way to get Matlab to ignore Rows 0 to 1973? Thanks for your help.
> 
> That was the point of this line.  It makes the year 1974 = 1, thus making it the first row.
> 
> data(:,1) = data(:,1)-min(data(:,1))+1; %normalize so 1974 is 1


That's great. Thanks for your help Sean.