Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Nerma Caluk
Nerma Caluk am 24 Jun. 2022
Beantwortet: Voss am 24 Jun. 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!

Antworten (1)

Voss
Voss am 24 Jun. 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

Kategorien

Mehr zu Data Type Identification finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by