|
On Jul 21, 5:11 am, "Geant Bepi"
<timothyschru_useonlywhatsbeforeundersc...@yahoo.co.uk> wrote:
> "Jesper Lauridsen" <jesperhols...@hotmail.com> wrote in message <h44342$4i...@fred.mathworks.com>...
> > I have the following data in a vector called DATA1:
>
> > 0.015
> > 0.01
> > 0.01
> > 0.01
> > 0.01
> > 0.005
> > 0.005
> > 0.005
> > 0.005
> > 0.005
> > 0.005
> > 0.005
> > 0.005
> > 0.005
>
> > What I want is to replace all values that are less or equal to 0.005 with zero in the vector. I was thinking to use some kind of if statement.
>
> > if DATA_1<=0.005
> > ...........
> > else
> > ...........
> > end
>
> there can be several methods to do this depending on how you are going to use the filtered data.
> try using logical indexing;
> e.g;
> data = DATA_1(:,1)
> zee = (data <= 0.005)
>
> then you can set 'zee' to zero when performing a calculation..- Hide quoted text -
>
> - Show quoted text -
Hi,
Try this,
AA=[0.015 0.01 0.01 0.01 0.01 0.005 0.005 0.005 0.005 0.005 0.005
0.005 0.005 0.005]
ind=find(AA<=0.005)
AA(ind)=0
David C.
|