Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe02.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix manipulation
References: <26885583.1227906197694.JavaMail.jakarta@nitrogen.mathforum.org>
In-Reply-To: <26885583.1227906197694.JavaMail.jakarta@nitrogen.mathforum.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 24
Message-ID: <IAZXk.5247$1s7.1398@newsfe02.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe02.iad 1227908520 24.79.146.116 (Fri, 28 Nov 2008 21:42:00 UTC)
NNTP-Posting-Date: Fri, 28 Nov 2008 21:42:00 UTC
Date: Fri, 28 Nov 2008 15:42:11 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:503711


Ross wrote:
> Assume you have array A, s.t. [N1 N2 N3] = size(A).
> Also, assume you have a vector p, s.t. N1 = length(p), whose entries are integers between 1 and N3.
> 
> You want to obtain a new matrix B, N1-by-N2 where the rows are selected using p.
> 
> Example:
> A = [1 2;3 4];
> A(:,:,2) = [10 20;30 40]
> p = [1 2];
> 
> B = [1 2; 30 40];
> 

That's pretty much the same task as was explored by a previous poster; you should be
able to adapt the solution I gave in

http://groups.google.ca/group/comp.soft-sys.matlab/browse_thread/thread/2316f0c1c23f97b4

-- 
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?