finding indices of values in a range

2 visualizaciones (últimos 30 días)
sparsh garg
sparsh garg el 20 de Sept. de 2021
Comentada: sparsh garg el 20 de Sept. de 2021
let's say you have a 2x300 matrix A,from that matrx,i select a sub array of dimension 2x24 whose range is as follows
[18 :41]
Now you have another matrix B which is an unordered version of the previous matrix.Meaning that value located at idnice 1 in A can be found in B at say 150.
How do i go about fidning at which indices do the values in the range of A occur in B
  1 comentario
sparsh garg
sparsh garg el 20 de Sept. de 2021
i tried using intersect but it didn't give me satisfactory results
for eg in the matrices shown below
the correct location of the values in query in the original matrix is
34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 80 82
similarly for query_2 the indices
are 33 35 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 20 de Sept. de 2021
To achieve the first task, you can use inqualities i.e. >, <. = etc.
To achieve the second task use ismember.
  1 comentario
sparsh garg
sparsh garg el 20 de Sept. de 2021
so what you are saying is i first do [~,idx]=find(original_matrix==query_matrix),
but the original matrix has 2 duplicates for every value in query_matrix.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by