Path: news.mathworks.com!not-for-mail
From: "AP Pal" <avispal@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Data Bin
Date: Sun, 4 Oct 2009 15:43:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 31
Message-ID: <haafq5$mvs$1@fred.mathworks.com>
Reply-To: "AP Pal" <avispal@gmail.com>
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 1254670981 23548 172.30.248.37 (4 Oct 2009 15:43:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 4 Oct 2009 15:43:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2020759
Xref: news.mathworks.com comp.soft-sys.matlab:574822


I am new to matlab and am stuck  with what seems simple task
i have  a column of data 1000 pts long. i need to average in groups of 10 so i need to generate a new matrix which has 100pts.

i was trying to write a code with a mini file and keep making mistakes

p=X
n=1;
i=1;
m=length(X);

avg_pts= 2;
z= length(X)/avg_pts
% q=0;
p(1,1)=X(1,1);

  for i=(1:1:z);
     
       for q=(1:1:avg_pts);
           if n+q<=m
       p(q,1)=p(q,1)+X(n+q,1);
           else
           end
       end
       y(i,1)=p(q,1)/avg_pts;
      n=n+avg_pts;
      
  end
 

Any help will be greatly appreciated
thanks