From: "Anthony Hopf" <>
Newsgroups: comp.soft-sys.matlab
Subject: Remapping Matrix Values (3d to 2d) for Convolution
Date: Sun, 4 Apr 2010 16:32:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <hpaeu5$kp5$>
Reply-To: "Anthony Hopf" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1270398725 21285 (4 Apr 2010 16:32:05 GMT)
NNTP-Posting-Date: Sun, 4 Apr 2010 16:32:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1899184
Xref: comp.soft-sys.matlab:623358

This is my first post... and I'm hoping I am overlooking something, but thank you in advance for any help.

I am starting off with a 3d matrix of points that are values in space, a simulated volume.  Each point is indexed with x, y and z values, e.g. Value = Matrix(xval,yval,zval).  I have also calculated the r, theta, and phi values to each point in the simulated volume.  Each of these values also have their own matrix, e.g. rvalue = r(xval,yval,zval).

What I would like to do is remap the original Matrix from above using the r, theta, and phi values mentioned for a constant r value to a 2d matrix.  I would like to set an r value with a filter like: r > 11e3-dx & r < 11e3+dx. This will likely give me a value for each theta and phi value at that r value.  Now I can filter the Matrix only keeping the new values and setting all of the other to NaN, still a 3d matrix.  What I would like to do now is take these values in Matrix and map them to a 2d matrix that way I can do a 2d convolution over them and place them back into the 3d matrix.

I realize I don't need to filter the points and replace the other points with NaN's but it was a way for me to visualize what I was doing.  My initial thought was to create a for loop that goes through each point and if it meets the criteria place it in the 2d matrix mapped to theta and phi values for a given r value... but this will take forever with a matrix that is 450x450x30.  The other issue is that phi ranges -pi to pi so I would need to "unwrap" the 3d space.

Does anyone have any ideas that may help?