From: "Jan Simon" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: average the elements of an array
Date: Fri, 16 Apr 2010 19:45:25 +0000 (UTC)
Organization: Universit&#228;t Heidelberg
Lines: 8
Message-ID: <hqaeol$t5q$>
References: <hq8551$hmu$>
Reply-To: "Jan Simon" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1271447125 29882 (16 Apr 2010 19:45:25 GMT)
NNTP-Posting-Date: Fri, 16 Apr 2010 19:45:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869888
Xref: comp.soft-sys.matlab:627323

Dear Matt!

> matrix(x,y) = ((matrix((x-1),y)+matrix(x,y)+matrix((x+1),y))/3);
> However, when I run this code, my matrix never changes.

This line is correct - although it is a really unusual computation as mentioned already. I assume your program has another problem. You cna inspect this by stopping the execution with the debugger: Set a break point with the debugger and step through your program line by line. You can show the contents of variables in the command line.

Good luck, Jan