Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Index of matrix element in Matlab

Status
Not open for further replies.

tombraided

Newbie level 2
Joined
Jan 22, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
London
Activity points
1,295
Hi there...

I have a matrix as:

a = [1 3 2 6 8 9 6]

can anyone tell how I would be able to get the index of the element(s) for 6. Here the answer should be [4,7]. It should be in matlab.


Thanks in advance. :)


-JML
 

I don't understand how you came up with [4,7].

Anyways, there is command ind2sub for that. And to go backwards sub2ind.

Hope this helps
 

a = [1 3 2 6 8 9 6];

if you want to get the index of the element(s) for 6, you should type with the following command

find(a == 6)

Therefore, the answer is 4 and 7

ps. I use matlab version 7.6 (R2008a) with the above command.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top