Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news.cse.ohio-state.edu!usenet01.sei.cmu.edu!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: vectorise a reshape loop
Date: Mon, 21 Jul 2008 13:36:06 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 18
Message-ID: <g623c6$ci$1@canopus.cc.umanitoba.ca>
References: <g5krk2$77v$1@fred.mathworks.com> <muy8ww0bjwd.fsf@G99-Boettcher.llan.ll.mit.edu> <g61k6f$1gj$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1216647366 402 192.70.172.160 (21 Jul 2008 13:36:06 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Mon, 21 Jul 2008 13:36:06 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:480664



In article <g61k6f$1gj$1@fred.mathworks.com>,
Dave Brackett <davebrackett@hotmail.com> wrote:

>    prodH(:,:,q,1)=ndfun('mprod',M(:,:,q,:))

>I still get:

>??? Assignment has more non-singleton rhs dimensions than
>non-singleton
>subscripts

try squeeze(M(:,:,q,:))

M(:,:,q,:) is a 4D array whose third dimension happens to be 1.
Matlab only automatically collapses trailing singleton array
dimensions.
-- 
  "Nothing recedes like success."             -- Walter Winchell