Path: news.mathworks.com!not-for-mail
From: "Lorenzo Guerrasio" <lorenzo.guerrasio@email.it>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Zeros some value in array
Date: Wed, 26 Aug 2009 08:47:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <h72sq7$o87$1@fred.mathworks.com>
References: <h70nah$rkk$1@fred.mathworks.com>
Reply-To: "Lorenzo Guerrasio" <lorenzo.guerrasio@email.it>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1251276423 24839 172.30.248.38 (26 Aug 2009 08:47:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 26 Aug 2009 08:47:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1371978
Xref: news.mathworks.com comp.soft-sys.matlab:566053


I'm not sure if I got what you want. take a look, maybe it helps. It's not the best solution, probably.

my_seq=[0 0 1 1 0];%here you put the sequence of zero you like
my_vect=rand(1,54353);
Nrep=floor(length(my_vect)/length(my_seq));
my_mask=repmat(my_seq,1,Nrep);
my_mask=[my_mask,my_seq(1:(length(my_vect)-length(my_mask)))];
new_vect=my_vect.*my_mask;



"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