How removing elements from vector?

조회 수: 7 (최근 30일)
huda nawaf
huda nawaf 2022년 8월 9일
댓글: huda nawaf 2022년 8월 10일
Hello,
How removing some elements from a long vector.
For example:
c=[1 2 3];
z=[10 9 1 4 11 2 6 3];
How removing c from z?
Tjanks in advance

채택된 답변

Stephen23
Stephen23 2022년 8월 9일
편집: Stephen23 2022년 8월 9일
c = [1,2,3]
c = 1×3
1 2 3
z = [10,9,1,4,11,2,6,3]
z = 1×8
10 9 1 4 11 2 6 3
x = setdiff(z,c,'stable')
x = 1×5
10 9 4 11 6
or
z(ismember(z,c)) = []
z = 1×5
10 9 4 11 6

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by