Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: storing output of computation into an array
Date: Sun, 20 Nov 2011 19:22:14 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 12
Message-ID: <jabk16$chh$1@newscl01ah.mathworks.com>
References: <jabg3i$sjk$1@newscl01ah.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1321816934 12849 172.30.248.38 (20 Nov 2011 19:22:14 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 20 Nov 2011 19:22:14 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:749905

"Pg " <poulomizca@gmail.com> wrote in message <jabg3i$sjk$1@newscl01ah.mathworks.com>...
> hi,
> 
> I h've an array A = [1 2 3; 56 7 8; 9 10 11]. Like this my actual A matrix size is 420x151. I want to compute moving average of each row of matrix A and store the output to a new matrix B of size (420-mx151), where m is the sliding window size. In what way I can do so. Plz. let me know.

If you are talking about moving average along rows (first dimension), then:

B = conv2(A,ones(m,1),'valid') / m

should do

Bruno