Effacer les filtres
Effacer les filtres

Exclude data points from 2 arrays, based on a 3rd array

2 vues (au cours des 30 derniers jours)
Nerma Caluk
Nerma Caluk le 24 Juin 2022
Réponse apportée : Voss le 24 Juin 2022
I have either 3 vectors, or a matrix with 3 columns, example: a, b, c; which are related by each row. I need to exclude values from a and b (or the whole row of the matrix) and then plot them, based on the values that they are related to c. For example:
a = [533 534 535 536 700]';
b = [123 124 125 126 200]';
c = [11100010010 11100010010 11100010010 11100010010 11100010011]';
I want to remove all values from a and b that are NOT CORRESPONDING to value of c = 11100010010 (like the last element of c, which indicates removal of last values from a and b, 200 and 700).
Thank You for your help!

Réponses (1)

Voss
Voss le 24 Juin 2022
a = [533 534 535 536 700]';
b = [123 124 125 126 200]';
c = [11100010010 11100010010 11100010010 11100010010 11100010011]';
idx = c ~= 11100010010;
a(idx) = [];
b(idx) = [];
disp(a); disp(b);
533 534 535 536 123 124 125 126

Catégories

En savoir plus sur Data Type Identification dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by