Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Find

Subject: Find

From: Dave Poreh

Date: 26 Apr, 2012 14:43:07

Message: 1 of 3

Folks
hi,
I want to find some data close to my data like this:
[m,n] matrix and i want to find the location of the # that m would be around for example 19.444 and n would be around in -99.073. But my m and n have xx.xxxxxx format. can someone please help me?
Cheers,
Dave

Subject: Find

From: dpb

Date: 26 Apr, 2012 15:09:54

Message: 2 of 3

On 4/26/2012 9:43 AM, dave poreh wrote:
> Folks
> hi,
> I want to find some data close to my data like this:
> [m,n] matrix and i want to find the location of the # that m would
> be around for example 19.444 and n would be around in -99.073. ...

 > x=rand(1,10);x(3)=19.444;
 > x(abs(x-19.444)<0.001)
ans =
    19.4440
 >> idx=find(x(abs(x-19.444)<0.001))
idx =
      1
 >> abs(x-19.444)<0.001
ans =
      0 0 1 0 0 0 0 0 0 0
 >>

You'll have to decide what tolerance is appropriate...

--

Subject: Find

From: dpb

Date: 26 Apr, 2012 16:50:39

Message: 3 of 3

On 4/26/2012 10:09 AM, dpb wrote:
...

> >> idx=find(x(abs(x-19.444)<0.001))
...

was intended to be

 > idx=find(abs(x-19.444)<0.001)
idx =
      3
 >>

to be of more general interest, of course...

--

Tags for this Thread

No tags are associated with this thread.

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.

Contact us