Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Zeros some value in array
Date: Tue, 25 Aug 2009 13:27:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <h70or6$ak0$1@fred.mathworks.com>
References: <h70nah$rkk$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1251206822 10880 172.30.248.35 (25 Aug 2009 13:27:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 25 Aug 2009 13:27:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1895050
Xref: news.mathworks.com comp.soft-sys.matlab:565796


"Jaroslav " <jaroslav.hrebicek@seznam.cz> wrote in message <h70nah$rkk$1@fred.mathworks.com>...
> Hi, 
> 
> how could I zeros some numbers in array? I need replace for example first three numbers by zeros, then keep original 2 numbers and then again replace next three numbers by zero etc.
> For example, I have array of 10 numbers A=[1:10]
> and result would be look like 0 0 0 4 5 0 0 0 9 10
> 
> Thanks

A=1:10;
idx=[1:3 6:8]; % indexes to make zero
A(idx)=0;