Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Problem with parfor
Date: Sat, 24 Oct 2009 03:48:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <hbttdk$r5q$1@fred.mathworks.com>
References: <hbrljb$7os$1@fred.mathworks.com> <ytw1vkuihn3.fsf@uk-eellis-deb5-64.mathworks.co.uk>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256356084 27834 172.30.248.37 (24 Oct 2009 03:48:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 24 Oct 2009 03:48:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2055496
Xref: news.mathworks.com comp.soft-sys.matlab:579738


Edric M Ellis <eellis@mathworks.com> wrote in message <ytw1vkuihn3.fsf@uk-eellis-deb5-64.mathworks.co.uk>...
> 
> Unfortunately, the subscripted assignment error appears to be due to a bug in
> PARFOR which incorrectly deals with some assignments - in this case, because
> you're slicing the second dimension out of 3. One workaround for this problem is
> to move the PARFOR loop to be the outer loop (generally a good idea in any
> case), but to do this you'll also need to calculate a whole chunk of your
> "motion" array, something like this:
> 
> parfor i = 1:Mdivs
>   tmp = zeros( Ndivs, 2 );
>   for j = 1:Ndivs
>     tmp( j, : ) = fun2( fun1( ... ) );
>   end
>   motion( i, :, : ) = tmp;
> end
> 
> Cheers,
> 
> Edric.

Well, I'll be... This worked like a charm. I did try to move the parfor to the outer loop earlier but couldn't quite figure out how to make the assignment.

Thanks so much!

Cheers,
Pravin