Re: can matlab plot data by condition
- From: "Ha Wanger" <virtualcyberinfo+nospam@xxxxxxxxx>
- Date: Wed, 31 Oct 2007 13:14:58 +0000 (UTC)
Thank you for your answer, but this method seems plot dot by
dot, in my test, it performs slower than mine, but thanks
anyway.
adinda <adinda.vandenberg@xxxxxxxxx> wrote in message
<1193824563.494029.291520@xxxxxxxxxxxxxxxxxxxxxxxxxxx>...
On 31 okt, 07:47, "Ha Wanger"<virtualcyberinfo+nos...@xxxxxxxxx>
wrote:are vectors
I have two matrix like these:
X = [1 2 3 4 5 6]
Y = [-3 -1 -2 2 -1 1]
I want to have a line-dot plot and when Y<0, the dot is red;
when Y>0, the dot is blue.
Now I'm using the follwing method:
1. creat two matrixs foo1 & foo2 from [X;Y]
foo1 = [1 2 3 5 ; -3 -1 -2 -1]
foo2 = [4 6 ; 2 1]
2. plot(foo1(1,:),foo1(2:,),'.r')
plot(foo2(1,:),foo2(2:,),'.b')
plot(X,Y,'-')
actually,the matrixs X & Y are very big so this method is
some inefficient.
Can anyone give me a better method? Thanks!
Probably there are better ways than this, but hey (X and Y
right?)
for k=1:length(Y)
if Y(k)>0
plot(X(k),Y(k),'b'), hold on
else plot(X(k),Y(k),'r'), hold on
end
end
hold off
.
- References:
- can matlab plot data by condition
- From: Ha Wanger
- Re: can matlab plot data by condition
- From: adinda
- can matlab plot data by condition
- Prev by Date: Re: Problem with GUI in matlab
- Next by Date: Re: displaying binary information
- Previous by thread: Re: can matlab plot data by condition
- Next by thread: Re: can matlab plot data by condition
- Index(es):
Relevant Pages
|