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:
how to find particular element in array

Subject: how to find particular element in array

From: Harsh

Date: 26 May, 2011 17:52:04

Message: 1 of 2

How do I find particular element in array and I also need the position of that element?

for eg.
Locate element 4 in A

A =

    [ 1 2 6 5
     2 3 7 6
     3 4 8 7
     5 6 10 9
     6 7 11 10]
     
output should be A(3,2)

Subject: how to find particular element in array

From: Roger Stafford

Date: 26 May, 2011 18:13:05

Message: 2 of 2

"Harsh" wrote in message <irm404$i3o$1@newscl01ah.mathworks.com>...
> How do I find particular element in array and I also need the position of that element?
>
> for eg.
> Locate element 4 in A
>
> A =
>
> [ 1 2 6 5
> 2 3 7 6
> 3 4 8 7
> 5 6 10 9
> 6 7 11 10]
>
> output should be A(3,2)
- - - - - - - - -
 [row,col] = find(A==4);

Roger Stafford

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