Shorting dissimilar Elements from an Array

조회 수: 1 (최근 30일)
Souarv De
Souarv De 2021년 5월 27일
댓글: Souarv De 2021년 5월 28일
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.

채택된 답변

Matt J
Matt J 2021년 5월 27일
편집: Matt J 2021년 5월 27일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by