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$>
References: <jabg3i$sjk$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1321816934 12849 (20 Nov 2011 19:22:14 GMT)
NNTP-Posting-Date: Sun, 20 Nov 2011 19:22:14 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: comp.soft-sys.matlab:749905

"Pg " <> wrote in message <jabg3i$sjk$>...
> 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