extracting value from a vector

2 vues (au cours des 30 derniers jours)
Andrea Miceli
Andrea Miceli le 18 Mar 2021
Commenté : Andrea Miceli le 18 Mar 2021
Hello everybody!
i need help extracting some values ​​from a vector. More specifically, I have two vectors A and B (vector A contains 1: 3000 while vector B contains 10 random numbers) and I need to extract from vector A only the values ​​contained in Vector B. I have already tried with "== "and" iseq ", but the vectors are not the same length and therefore I cannot perform the operation.
thank you for your time!

Réponse acceptée

Olof Engström
Olof Engström le 18 Mar 2021
[intersection, indices] = intersect(A,B)
There you get the intersecting values and the indices to the intersecting values in A
  1 commentaire
Andrea Miceli
Andrea Miceli le 18 Mar 2021
Thank you! It's worked.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by