Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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!

Risposte (1)

Voss
Voss il 24 Giu 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

Categorie

Scopri di più su Data Type Identification in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by