Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: inserting conditional data in a multidimensional matrix without using nested loop
Date: Thu, 9 Sep 2010 16:17:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <i6b1a0$hnh$1@fred.mathworks.com>
References: <i6am4g$7s7$1@fred.mathworks.com> <i6b04h$35a$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1284049024 18161 172.30.248.35 (9 Sep 2010 16:17:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 9 Sep 2010 16:17:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:668847

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i6b04h$35a$1@fred.mathworks.com>...
>  [X,Y,Z] = ndgrid(1:8,1:8,1:8);
>  p = Z==1 | Z==8 | (.1)^2 < ( ((X-4.5)*.01).^2 + ((Y-4.5)*.01).^2 );
>  q = ((.03)^2 < (((X-4.5)*.01+0).^2+((Y-4.5)*.01+0).^2)) | ...
>       ((Z-.4.5)*.01 > .4) | ((Z-4.5)*.01 < -.4);
>  V = (~p) + (~(p|q));
> 
> Roger Stafford
- - - - - - -
  There's a typo in the q line.  It should read:

 q = ((.03)^2 < (((X-4.5)*.01+0).^2+((Y-4.5)*.01+0).^2)) | ...
      ((Z-4.5)*.01 > .4) | ((Z-4.5)*.01 < -.4);

Roger Stafford