Shorting dissimilar Elements from an Array

1 Ansicht (letzte 30 Tage)
Souarv De
Souarv De am 27 Mai 2021
Kommentiert: Souarv De am 28 Mai 2021
Suppose I have an array A of elements from 1 to 20 sequentially. Let B = [10 9 2 4 7 16 17 15 11 13]. I need an array C (Assending Order) containing the remaining elements of A i.e which is not in B.

Akzeptierte Antwort

Matt J
Matt J am 27 Mai 2021
Bearbeitet: Matt J am 27 Mai 2021
A=1:20;
B= [10 9 2 4 7 16 17 15 11 13];
C=setdiff(A,B)
C = 1×10
1 3 5 6 8 12 14 18 19 20

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by