Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Plotting a graph of three variables
Date: Sat, 2 Oct 2010 07:12:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <i86m04$fbb$1@fred.mathworks.com>
References: <i5d7in$p17$1@fred.mathworks.com> <i5ddlj$ilv$1@fred.mathworks.com> <i5dkbb$lco$1@fred.mathworks.com> <i5dkoh$hj1$1@fred.mathworks.com> <i5dtfr$10r$1@fred.mathworks.com> <i5edc0$euq$1@fred.mathworks.com> <i72fqr$gip$1@fred.mathworks.com> <i72iu8$153$1@fred.mathworks.com> <i73ko5$mv0$1@fred.mathworks.com> <i73m5c$ktu$1@fred.mathworks.com> <i73o4s$nmb$1@fred.mathworks.com> <i74djn$4gb$1@fred.mathworks.com> <i751gm$b82$1@fred.mathworks.com> <i75uo8$nr1$1@fred.mathworks.com> <i84vcl$c05$1@fred.mathworks.com> <i85mjk$eia$1@fred.mathworks.com> <i86bbc$sqi$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1286003524 15723 172.30.248.37 (2 Oct 2010 07:12:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 2 Oct 2010 07:12:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2386204
Xref: news.mathworks.com comp.soft-sys.matlab:675228

"Prasad M. Rao" <XLR8RPM@Gmail.com> wrote in message <i86bbc$sqi$1@fred.mathworks.com>...
> Hey Mark your code worked great, but just one tiny problem, however I try, there are 3 separate plots on 3 graphs rather than 3 plots on the same graph.
> I don't know why the hold function ain't working.
> Please advise.
> 
> Hey Ross, thanks for all the help, your code gave this error 
> ??? Error using ==> and
> Too many input arguments.

hmmmm ... maybe some missing parentheses in my for loop? I don't have matlab with me now, so perhaps you can try to sort it out if it fails again?

Zlist=[1.2 1.3 1.4 ];

col='rgbymck'; %a list of colours (longer than it needs to be ...)

for m=1:(numel(Zlist)-1)
 n=find(Z>Zlist(m) & Z<=Zlist(m+1));
 plot(X(n),Y(n),col(m))
 hold on
end

Ross