How removing elements from vector?

4 次查看(过去 30 天)
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