[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## FW: Easy about Matrices

**From**: |
Frank Palazzolo |

**Subject**: |
FW: Easy about Matrices |

**Date**: |
Mon, 18 Apr 2005 14:26:32 -0400 |

Woops - you're right - sorry, I got my threads confused. I was still
thinking about the zero-crossings problem. :(
-Frank
-----Original Message-----
From: Quentin Spencer [mailto:address@hidden
Sent: Monday, April 18, 2005 2:20 PM
To: Frank Palazzolo
Cc: address@hidden
Subject: Re: Easy about Matrices
Frank Palazzolo wrote:
>*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*
>* *
>
This is definitely faster, but it doesn't return the same matrix:
octave:1> x=randn(1,10);
octave:1> (x>0)
ans =
Columns 1 through 8:
1 1 0 0 0 0 1 0
Columns 9 and 10:
1 1
octave:3> x(find(x>0))
ans =
0.93970 0.38451 0.30387 0.81479 2.46831
-------------------------------------------------------------
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
-------------------------------------------------------------

**Re: Easy about Matrices**, *(continued)*
**Re: Easy about Matrices**, *Mike Miller*, `2005/04/18`
**Re: Easy about Matrices**, *Geordie McBain*, `2005/04/18`
**Re: Easy about Matrices**, *Mike Miller*, `2005/04/18`
**Re: Easy about Matrices**, *Alvaro Aguilera*, `2005/04/19`
**Re: Easy about Matrices**, *Peter Bodin*, `2005/04/19`
**Re: Easy about Matrices**, *Alvaro Aguilera*, `2005/04/19`
**Re: Easy about Matrices**, *Peter Bodin*, `2005/04/19`
**Re: Easy about Matrices**, *Mike Miller*, `2005/04/19`

**FW: Easy about Matrices**,
*Frank Palazzolo* **<=**