Thread Subject: Reducing matrix size by finding similar elements

Subject: Reducing matrix size by finding similar elements

From: Lisa Chen

Date: 10 Jan, 2008 22:03:22

Message: 1 of 5

I have read CFD contaminant data into Matlab. I would like
to reduce the size of that data by finding groups of points
with similar concentrations. Is there a command for finding
like elements in a matrix? Please help, thanks!

Subject: Reducing matrix size by finding similar elements

From: Ian Clarkson

Date: 10 Jan, 2008 22:19:03

Message: 2 of 5

"Lisa Chen" <yhc22@drexel.edu> wrote in message
<fm64na$53s$1@fred.mathworks.com>...
> I have read CFD contaminant data into Matlab. I would
like
> to reduce the size of that data by finding groups of
points
> with similar concentrations. Is there a command for
finding
> like elements in a matrix? Please help, thanks!

Could you provide a bit more detail? I don't anything about
CFD -- could you just give, say, an example of a 5x5 matrix
with a before and after shot? Say you want to turn:

[1 2 2.0001 3] -> [1 2 3]

Is that what you mean by finding like elements?

If that's the case, maybe something like:

>>data=[1.83 2.845 2.001 3.2343 3.24 3.25 3.26];
>>roundData=round(data/0.1)*0.1; % rounds to nearest tenth
>>unique(roundData)
ans =
    1.8000 2.0000 2.8000 3.2000 3.3000

Subject: Reducing matrix size by finding similar elements

From: Anh Huy Phan

Date: 11 Jan, 2008 10:29:04

Message: 3 of 5

"Ian Clarkson" <ian.clarkson@gesturetek.com> wrote in message
<fm65km$o1h$1@fred.mathworks.com>...
> "Lisa Chen" <yhc22@drexel.edu> wrote in message
> <fm64na$53s$1@fred.mathworks.com>...
> > I have read CFD contaminant data into Matlab. I would
> like
> > to reduce the size of that data by finding groups of
> points
> > with similar concentrations. Is there a command for
> finding
> > like elements in a matrix? Please help, thanks!
>
> Could you provide a bit more detail? I don't anything about
> CFD -- could you just give, say, an example of a 5x5 matrix
> with a before and after shot? Say you want to turn:
>
> [1 2 2.0001 3] -> [1 2 3]
>
> Is that what you mean by finding like elements?
>
> If that's the case, maybe something like:
>
> >>data=[1.83 2.845 2.001 3.2343 3.24 3.25 3.26];
> >>roundData=round(data/0.1)*0.1; % rounds to nearest tenth
> >>unique(roundData)
> ans =
> 1.8000 2.0000 2.8000 3.2000 3.3000


Suppose D is the number of accurate digits, you can also do
this by using vpa function

>> data=[1.83 2.845 2 2.001 3.2343 3.24 3.25 3.26]
>> d = 2;
>> double(unique(vpa(data,d)))
            
ans =

   1.8000 2.0000 2.8000 3.2000 3.3000


>> d = 3;
>> double(unique(vpa(data,d)))

ans =

    1.8300 2.0000 2.8400 3.2300 3.2400
3.2500 3.2600


Anh Huy Phan
RIKEN - BSI


Subject: Reducing matrix size by finding similar elements

From: Lisa Chen

Date: 15 Jan, 2008 21:06:02

Message: 4 of 5

This helps a lot, thanks Anh!

Lisa


"Anh Huy Phan" <phananhhuy@mathworks.com> wrote in message
<fm7gdg$km0$1@fred.mathworks.com>...
> "Ian Clarkson" <ian.clarkson@gesturetek.com> wrote in
message
> <fm65km$o1h$1@fred.mathworks.com>...
> > "Lisa Chen" <yhc22@drexel.edu> wrote in message
> > <fm64na$53s$1@fred.mathworks.com>...
> > > I have read CFD contaminant data into Matlab. I would
> > like
> > > to reduce the size of that data by finding groups of
> > points
> > > with similar concentrations. Is there a command for
> > finding
> > > like elements in a matrix? Please help, thanks!
> >
> > Could you provide a bit more detail? I don't anything
about
> > CFD -- could you just give, say, an example of a 5x5
matrix
> > with a before and after shot? Say you want to turn:
> >
> > [1 2 2.0001 3] -> [1 2 3]
> >
> > Is that what you mean by finding like elements?
> >
> > If that's the case, maybe something like:
> >
> > >>data=[1.83 2.845 2.001 3.2343 3.24 3.25 3.26];
> > >>roundData=round(data/0.1)*0.1; % rounds to nearest
tenth
> > >>unique(roundData)
> > ans =
> > 1.8000 2.0000 2.8000 3.2000 3.3000
>
>
> Suppose D is the number of accurate digits, you can also
do
> this by using vpa function
>
> >> data=[1.83 2.845 2 2.001 3.2343 3.24 3.25 3.26]
> >> d = 2;
> >> double(unique(vpa(data,d)))
>
> ans =
>
> 1.8000 2.0000 2.8000 3.2000 3.3000
>
>
> >> d = 3;
> >> double(unique(vpa(data,d)))
>
> ans =
>
> 1.8300 2.0000 2.8400 3.2300 3.2400
> 3.2500 3.2600
>
>
> Anh Huy Phan
> RIKEN - BSI
>
>

Subject: Reducing matrix size by finding similar elements

From: Lisa Chen

Date: 15 Jan, 2008 21:07:01

Message: 5 of 5

Thanks, Ian!!!

"Ian Clarkson" <ian.clarkson@gesturetek.com> wrote in
message <fm65km$o1h$1@fred.mathworks.com>...
> "Lisa Chen" <yhc22@drexel.edu> wrote in message
> <fm64na$53s$1@fred.mathworks.com>...
> > I have read CFD contaminant data into Matlab. I would
> like
> > to reduce the size of that data by finding groups of
> points
> > with similar concentrations. Is there a command for
> finding
> > like elements in a matrix? Please help, thanks!
>
> Could you provide a bit more detail? I don't anything
about
> CFD -- could you just give, say, an example of a 5x5
matrix
> with a before and after shot? Say you want to turn:
>
> [1 2 2.0001 3] -> [1 2 3]
>
> Is that what you mean by finding like elements?
>
> If that's the case, maybe something like:
>
> >>data=[1.83 2.845 2.001 3.2343 3.24 3.25 3.26];
> >>roundData=round(data/0.1)*0.1; % rounds to nearest tenth
> >>unique(roundData)
> ans =
> 1.8000 2.0000 2.8000 3.2000 3.3000

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
matrix Lisa Chen 10 Jan, 2008 17:05:06
reduce size Lisa Chen 10 Jan, 2008 17:05:06
cfd Lisa Chen 10 Jan, 2008 17:05:06
rssFeed for this Thread

Public Submission Policy

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 Disclaimer prior to use.

Contact us at files@mathworks.com