help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting masks


From: Dirk Eddelbuettel
Subject: getting masks
Date: Mon, 24 May 1999 10:38:33 -0400 (EDT)

  Artur Jorge Azevedo Carvalho writes:
  Artur>  hi! how can i do in an oct file the following: a=[ 1.1 1.2 3.2 1.4
  Artur> 0.0 2.3 6.3 -5.1 1.1 ] a!=0 to give [ 1 1 1 1 0 1 1 1 1 ]
  Artur> 
  Artur> the best way i've found to do this was: a=Matrix(!!a);
  Artur> 
  Artur> to give the same result, but it has to exist a better way to do
  Artur> this...

Use  a != 0 as here:

address@hidden:~> octave
GNU Octave, version 2.0.14 (i386-pc-linux-gnu).
Copyright (C) 1996, 1997, 1998, 1999 John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.

octave:1> a=[1.1 1.2 3.2; 1.4 0.0 2.3; 6.3 -5.1 1.1];
octave:2> b=a!=0
b =

  1  1  1
  1  0  1
  1  1  1
                              

-- 
According to the latest figures, 43% of all statistics are totally worthless.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]