|
|
Help with finding index
I have an array of say :
a =
2 3 4
5 6 2
4 2 1
7 2 4
I want to find the index of an exact vector.
For instance, I want to find the row index of vector [4 2 1], answer is 3(row 3).
The vector [7 2 4] will return index 4.
The find function does not work , any suggestion.
|
|
0
|
|
|
|
Reply
|
ade77
|
11/20/2009 10:37:19 PM |
|
ade77 wrote:
> I have an array of say :
....>
> I want to find the index of an exact vector.
> For instance, I want to find the row index of vector ...
doc intersect
--
|
|
0
|
|
|
|
Reply
|
dpb
|
11/20/2009 10:45:50 PM
|
|
dpb <none@non.net> wrote in message <he7677$3mi$1@news.eternal-september.org>...
> ade77 wrote:
> > I have an array of say :
> ...>
> > I want to find the index of an exact vector.
> > For instance, I want to find the row index of vector ...
>
> doc intersect
>
> --
Thank you. Works perfectly
|
|
0
|
|
|
|
Reply
|
ade77
|
11/20/2009 10:55:19 PM
|
|
Hi,
the "Intersect" function works well in this case, but if I have this matrix
a =
4 2 1
5 6 2
4 2 1
7 2 4
And, If I want to find "all' rows index of vector [4 2 1], answers are rows 1 and 3.
[i,ii,iii]=Intersect(a,[4 2 1],'rows') give just the last row index, (3) in this case.
|
|
0
|
|
|
|
Reply
|
LCPC
|
12/9/2009 3:46:31 PM
|
|
Look at ismember with the rows option.
|
|
0
|
|
|
|
Reply
|
Matt
|
12/9/2009 4:49:01 PM
|
|
"LCPC Yannick" <yannick.fargier@hotmail.fr> wrote in message <hfogon$jrk$1@fred.mathworks.com>...
> Hi,
>
> the "Intersect" function works well in this case, but if I have this matrix
>
> a =
>
> 4 2 1
> 5 6 2
> 4 2 1
> 7 2 4
>
> And, If I want to find "all' rows index of vector [4 2 1], answers are rows 1 and 3.
> [i,ii,iii]=Intersect(a,[4 2 1],'rows') give just the last row index, (3) in this case.
STRMATCH will also work
>> strmatch([4 2 1], a)
ans =
1
3
|
|
0
|
|
|
|
Reply
|
Matt
|
12/9/2009 7:39:20 PM
|
|
thank you Matt & Matt, it works perfectly.
|
|
0
|
|
|
|
Reply
|
LCPC
|
12/10/2009 10:19:19 AM
|
|
|
6 Replies
146 Views
(page loaded in 0.061 seconds)
Similiar Articles: Matlab Help with finding x and y values - comp.soft-sys.matlab ...Help with finding index - comp.soft-sys.matlab Matlab Help with finding x and y values - comp.soft-sys.matlab ... Help with finding index - comp.soft-sys.matlab Help with ... find / ismember / index within structure array - comp.soft-sys ...Hey! I'm a frustrated MATLAB beginner and need some help. I have a structure array containing two double arrays and one cell array: S = ... to get indices of an array - comp.soft-sys.matlabHow to find tha index of maximum value in a row vector i have to find index ... tha index of maximum value in a row vector i have to find index value of maximum ... help ... Finding the maximum value of a matrix - comp.soft-sys.matlab ...MATLAB matrix help - comp.soft-sys.matlab Help with finding index - comp.soft-sys.matlab MATLAB matrix help - comp.soft-sys.matlab Finding the maximum value of a matrix ... MATLAB matrix help - comp.soft-sys.matlabHelp with finding index - comp.soft-sys.matlab MATLAB matrix help - comp.soft-sys.matlab Finding the maximum value of a matrix - comp.soft-sys.matlab ... Please help, how to use "for loop" to list out the coordinate ...Please help, how to use "for loop" to list out the coordinate/index of matrix elements in every row Follow Search Could Not Load the Index - Help - comp.text.pdfSearch Could Not Load the Index - Help - comp.text.pdf ImportError: DLL load failed: The specified module could not be ... ImportError: DLL load failed: The specified ... Find elements in a cell array and index the cell number - comp ...... cell' cannot directly used in function "find"; besides, the size isn't a problem, if you re-modify the naive index produced by the find function. hope it can help ... Help to 'pretty'; replace WITHIN file without TEMP file?? - comp ...The gawk.hlp command from the command line launches the Windows help feature. I find the Index more useful than the menu. -- T.E.D. (tdavis@umr.edu) finding the closest number in an array - comp.soft-sys.matlab ...... in this case could be 1998 or 2001 ) and the index (i ... So please, HELP ME ! I have one array, let's say it ... largest n element of an array - comp.soft-sys ... how to find ... Find indices and values of nonzero elements - MATLAB... Index • ... ind = find(X, k) or ind = find(X, k, 'first') returns at ... © 1984-2012- The MathWorks, Inc. - Site Help - ... Help Find Shane FellA Family Pleads for Help New Video - as of 04-06-2012. Shane was driving a dark blue/green Saturn. The accident happened on River Road between Klein Road and Marrero ... 7/15/2012 8:37:14 PM
|
|
|
|
|
|
|
|
|