help-octave
[Top][All Lists]
Advanced

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

Re: removing columns


From: Francesco Potortì
Subject: Re: removing columns
Date: Tue, 03 May 2011 15:30:46 +0200

>              I have a matrix of which all elements in some columns are
>zeroes.  Is there any trick to remove this columns
>and form a new matrix

octave> a=rand(5)>0.8
a =

   0   0   0   0   0
   0   0   1   0   0
   1   1   0   1   0
   0   0   1   1   0
   0   0   0   0   0

octave> a(:,!any(a))=[]
a =

   0   0   0   0
   0   0   1   0
   1   1   0   1
   0   0   1   1
   0   0   0   0

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

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