Help in finding the matrix

Hello! I have a vector of values, and I need to find their location in the matrix
% 1000x100 matrix
% 1x100 data

6 comentarios

Adam Danz
Adam Danz el 12 de Sept. de 2019
Editada: Adam Danz el 12 de Sept. de 2019
Hint:
  • ismember()
  • find() (if you want subscripts)
Lev Mihailov
Lev Mihailov el 12 de Sept. de 2019
X=[1 2 3 4 5 6 7
112 123 123 124 216 125 125
1 2 3 4 5 6 229]
Y=[112 123 123 124 216 125 229]
I took part of the code as it looks
Adam Danz
Adam Danz el 12 de Sept. de 2019
Now try to apply my hint. The documentation will help you understand how each function works.
Andrei Bobrov
Andrei Bobrov el 12 de Sept. de 2019
In this case, what result do you expect?
Lev Mihailov
Lev Mihailov el 12 de Sept. de 2019
Z=ismember(Y,X);
When used along the entire length of the file, it produces a logical and all values ​​= 1
Adam Danz
Adam Danz el 12 de Sept. de 2019
That's because all element of Y are indeed in X. Try it the other way around. X as the first input.

Iniciar sesión para comentar.

Respuestas (1)

J Chen
J Chen el 12 de Sept. de 2019

0 votos

You can use [row,col]=find( ) to get the location and use == to compare numbers

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 12 de Sept. de 2019

Respondida:

el 12 de Sept. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by