Thread Subject: Data analysis

Subject: Data analysis

From: Jesper Lauridsen

Date: 21 Jul, 2009 09:52:02

Message: 1 of 7

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

Subject: Data analysis

From: us

Date: 21 Jul, 2009 10:01:04

Message: 2 of 7

"Jesper Lauridsen" <jesperholst_5@hotmail.com> wrote in message <h44342$4iu$1@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

one of the solutions

     data1(data1<=.005)=0;

us

Subject: Data analysis

From: Shanmugam Kannappan

Date: 21 Jul, 2009 10:03:02

Message: 3 of 7

"Jesper Lauridsen" <jesperholst_5@hotmail.com> wrote in message <h44342$4iu$1@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
Hi!

Try this...
DATA1(DATA1<=0.005)=0;
Shan.......

Subject: Data analysis

From: Geant Bepi

Date: 21 Jul, 2009 10:11:02

Message: 4 of 7

"Jesper Lauridsen" <jesperholst_5@hotmail.com> wrote in message <h44342$4iu$1@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..

Subject: Data analysis

From: david.correa@gmail.com

Date: 21 Jul, 2009 17:11:01

Message: 5 of 7

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.

Subject: Data analysis

From: us

Date: 21 Jul, 2009 17:25:19

Message: 6 of 7

"david.correa@gmail.com"
> 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

no, unfortunately not as good as other solutions already proposed in this thread...

us

Subject: Data analysis

From: aasim Azooz

Date: 21 Jul, 2009 18:43:05

Message: 7 of 7

"Jesper Lauridsen" <jesperholst_5@hotmail.com> wrote in message <h44342$4iu$1@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
Try

k=find(DATA1<=0)
DATA1(k)=0

good luck

Aasim Azooz

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
logical indexing Geant Bepi 21 Jul, 2009 06:14:10
logical indexing us 21 Jul, 2009 06:04:05
code us 21 Jul, 2009 06:04:05
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com