Path: news.mathworks.com!newsfeed-00.mathworks.com!fu-berlin.de!news.swapon.de!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to use a vector as an index for a matrix
Date: Thu, 09 Aug 2012 09:45:05 -0500
Organization: Aioe.org NNTP Server
Lines: 23
Message-ID: <k00idl$ln6$1@speranza.aioe.org>
References: <k00d1c$13u$1@newscl01ah.mathworks.com> <k00i2i$ih3$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: D3gpHu+Tqx1T0egJYGBFjA.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:776057

On 8/9/2012 9:39 AM, Matt J wrote:
...

> I may be missing something, but I don't see why people are recommending
> sub2ind here. This should do it:
>
> tcell=num2cell(t);
> M(tcell{:})

Actually, you're correct, Matt.  :)

Classic case of misdirection where the vector gets one thinking in the 
wrong direction...

I'm curious since my version doesn't have the multilevel indexing--does

M(num2cell(t){:});

work w/o the temporary (I'd hope)?

--