Path: news.mathworks.com!not-for-mail
From: "us " <us@neurol.unizh.ch>
Newsgroups: comp.soft-sys.matlab
Subject: Re: deleting 0s from an array
Date: Thu, 16 Aug 2007 01:22:09 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 14
Message-ID: <fa08s1$r4b$1@fred.mathworks.com>
References: <fa07po$f1c$1@fred.mathworks.com>
Reply-To: "us " <us@neurol.unizh.ch>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187227329 27787 172.30.248.37 (16 Aug 2007 01:22:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 16 Aug 2007 01:22:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:424083


James:
<SNIP no-zeros, please, evergreen...

>   Is there any easy way to delete all zero values from an 
array...

one of the copious solutions

% the data
     d=[0,0,0,1,0,0,0,2,0,0,0,3]
% ...without zeros
     d(d==0)=[]

us