[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Easy about Matrices
From: |
Frank Palazzolo |
Subject: |
RE: Easy about Matrices |
Date: |
Mon, 18 Apr 2005 13:59:34 -0400 |
This syntax works as well:
x = randn(1,1000);
x_positive = (x>=0);
x_negative = (x<0);
I'm not sure if it's any more efficient, but it seems it would be, since it
never needs to build an explicit index vector.
-Frank
-----Original Message-----
From: Quentin Spencer [mailto:address@hidden
Sent: Monday, April 18, 2005 1:43 PM
To: Alvaro Aguilera
Cc: address@hidden
Subject: Re: Easy about Matrices
Alvaro Aguilera wrote:
> Hello,
>
> I want to plot the data inside a matrix, but with different colors for
> the negative and positve terms. I do this now by spliting the matrix
> into two (negative, positive) using a "for" loop, and I wonder if
> there is another better approach to do this.
>
> Any hint welcome :)
>
> Regards,
> Alvaro.
>
I'm not completely sure if this is what you're looking for, but maybe
this example helps:
x = randn(1,1000);
x_positive = x(find(x>=0));
x_negative = x(find(x<0));
-Quentin
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------