Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe14.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: inverse of meshgrid?
References: <gcav3h$5fl$1@fred.mathworks.com>
In-Reply-To: <gcav3h$5fl$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 22
Message-ID: <nT2Gk.4548$rd1.359@newsfe14.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe14.iad 1223211603 24.79.146.116 (Sun, 05 Oct 2008 13:00:03 UTC)
NNTP-Posting-Date: Sun, 05 Oct 2008 13:00:03 UTC
Date: Sun, 05 Oct 2008 15:00:27 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:493729


David Doria wrote:
> some functions, like sphere(), return data that is ready for plotting with
> something like mesh or surf. If I am interested in plotting the points returned
> by a function like this, I have done

> [X Y Z] = sphere;
> n = 21;
> counter = 0;
> for i = 1:n
>     for j = 1:n
>         counter = counter + 1;
>         x(counter) = X(i,j);
>         y(counter) = Y(i,j);
>         z(counter) = Z(i,j);
>     end
> end
 
> plot3(x, y, z, 'o')

> Is there a better way to do this?

plot3(X(:), Y(:), Z(:), 'o')