Conditional Statements Between Two Arrays

1 vue (au cours des 30 derniers jours)
Nathaniel Wolff
Nathaniel Wolff le 11 Déc 2019
Commenté : Nathaniel Wolff le 19 Août 2020
I am trying to compare each value between two large arrays then store true values as another array. What do I type?
  2 commentaires
Ruger28
Ruger28 le 11 Déc 2019
What have you tried?
Nathaniel Wolff
Nathaniel Wolff le 11 Déc 2019
If (x>y) %I don't know how to list the true statement as a new variable End

Connectez-vous pour commenter.

Réponse acceptée

Ruger28
Ruger28 le 11 Déc 2019
a = 1:100;
b = 1:2:100;
c = ismember(a,b); % index of values of array a inside of array b
d = a(c); % the values inside of a that are in b

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays 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