From: us on
"Lisette de Boer" <lisettede_boer(a)hotmail.com> wrote in message <hif8td$5vf$1(a)fred.mathworks.com>...
>
> > well, this works - and should do what you need...
> > did you copy/paste the snippet(?)...
> > did it yield an output(?)...
> > if(f) so: what does not work for you(?)...
> >
> > us
>
> Hi,
>
> I did something wrong but now it works. One more question; how do I do this if i want more than 2 colors, so i want to make the distinction between L<0, 0<L<0.5 and 0.5<L<1?
>
> thanks again!

one of the solutions

cn=3; % <- #conditions
cmap=jet(cn); % <- select your own colors...
tftmpl=false(size(L)); % <- create an all-false template...
for i=1:cn
tf=tftmpl; % <- start with a clean tf...
if i==1
tf(L<0)=true;
elseif i==2
tf(L>=0 & L<.5)=true;
else
tf(L>=.5)=true;
end
quiver(x(tf),...,'color',cmap(i,:)); % <- as above...
end

us
From: Lisette de Boer on

> one of the solutions
>
> cn=3; % <- #conditions
> cmap=jet(cn); % <- select your own colors...
> tftmpl=false(size(L)); % <- create an all-false template...
> for i=1:cn
> tf=tftmpl; % <- start with a clean tf...
> if i==1
> tf(L<0)=true;
> elseif i==2
> tf(L>=0 & L<.5)=true;
> else
> tf(L>=.5)=true;
> end
> quiver(x(tf),...,'color',cmap(i,:)); % <- as above...
> end
>
> us

Hi.

Ok, this works, but it is really slow. I tried to take the quiver outside the for loop, but that failed; it only plotted the ones with L>0.5. Is it possible to take it outside the forloop to increase the speed of my program?

Thanks.
First  |  Prev  | 
Pages: 1 2
Prev: Image Overlay using pcolor-Plots
Next: redundancies