help-octave
[Top][All Lists]
Advanced

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

Maidir le: removing columns


From: OCuanachain, Oisin (Oisin)
Subject: Maidir le: removing columns
Date: Tue, 3 May 2011 12:19:33 +0100

 

 

From: address@hidden [mailto:address@hidden Thar ceann nuncio m
Sent: 3 Bealtaine 2011 12:01
To: address@hidden
Subject: removing columns

 

Hi list,
              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
Thanks
nuncio

--
Nuncio.M
Research Scientist
National Center for Antarctic and Ocean research
Head land Sada
Vasco da Gamma
Goa-403804

 

There’s probably a better/quicker way but this should work:

 

s = size(mat);

 

inds = (mat==0)

tmp = sum(inds);

 

mat1 = mat(:,tmp~=s(1));

 

mat1 will now contain the desired matrix with all zero columns removed.

 


reply via email to

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