help-octave
[Top][All Lists]
Advanced

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

Re: Mask the matrix


From: Przemek Klosowski
Subject: Re: Mask the matrix
Date: Tue, 12 May 2009 10:59:58 -0400 (EDT)

You can do it this way: a(:,!sum(a==0))

Explanation:

 - a==0 is a matrix with '1' where your data has zeros
 - sum(a==0) adds them up columnwise, so it will be zero only if no zeros were 
in that column.
 - a(:,!sum(a==0)) selects full columns based on a boolean mask created from 
the prev. expression



reply via email to

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