Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: find elements to include page indices
Date: Wed, 23 Jul 2008 16:23:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <g67lt6$4c9$1@fred.mathworks.com>
References: <g677t2$j92$1@fred.mathworks.com> <g67c9g$lsl$1@fred.mathworks.com> <g67foc$92q$1@fred.mathworks.com> <g67hkb$5bl$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1216830182 4489 172.30.248.38 (23 Jul 2008 16:23:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Jul 2008 16:23:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:481279



> i believe you have your inputs to the ind2sub switched: the
> first argument is the size and the second argument are the
> values you're interested in.

ah yeah, thanks. I can now get the subscripts and have
assigned them to a variable, a, which is then of the size
[788 3] with rows like:

[1 2 1;
 1 6 1;
 1 9 1;
 1 10 1;
 1 11 1;
 1 12 1;
 ...etc]

I want to use the indices at each row to extract the
corresponding elements from another matrix, b, which is of
the size [90 16 50].

I tried to implement this as simply c=b(a) but I get c as of
the size [788 3] whereas it should be of the form [90 16 50].

If I write c=b(1,2,1) I can get a single element, but if i
write c=b([1 2 1]) i get 3 elements. Why is there a
difference between these 2 methods? I think this might be
the cause of this problem.

Thanks