Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Zeros some value in array
Date: Wed, 26 Aug 2009 07:15:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <h72nds$8jl$1@fred.mathworks.com>
References: <h70nah$rkk$1@fred.mathworks.com> <h70or6$ak0$1@fred.mathworks.com> <h71eqr$6rf$1@fred.mathworks.com> <h71her$1c6$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1251270908 8821 172.30.248.37 (26 Aug 2009 07:15:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 26 Aug 2009 07:15:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1920846
Xref: news.mathworks.com comp.soft-sys.matlab:566037


"Andy " <theorigamist@gmail.com> wrote in message <h71her$1c6$1@fred.mathworks.com>...
> "Jaroslav " <jaroslav.hrebicek@seznam.cz> wrote in message <h71eqr$6rf$1@fred.mathworks.com>...
> > "Andy " <theorigamist@gmail.com> wrote in message <h70or6$ak0$1@fred.mathworks.com>...
> > > "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;
> > 
> > Thanks Andy,
> > 
> > but in fact, I will have about 95000 samples. So this way is not what I looking for..
> > 
> > But thank you..
> 
> % This approach still works with 95000 samples.  You just want to create idx in
> % some way other than explicitly choosing which indexes to remove.
> 
> % Example: create a vector of random data and remove all values below 0.3:
> 
> A=rand(100000,1);
> idx=find(A<0.3);
> A(idx)=0;
> 
> % If you'd like more help doing this, what are your criteria for determining which
> % indexes you want to replace with 0?


It does not matter, what indexes will be replaced with 0. But the number of  0 must be always same and this interval of zeros should be repeated randomly or periodically up to end of samples (in array).