フィルターのクリア

How do I delete a series of elements from a vector?

1 回表示 (過去 30 日間)
Ronen Ron
Ronen Ron 2015 年 7 月 19 日
回答済み: Naty S 2015 年 7 月 19 日
example:
a=[1 1 1 2 3 3 5 5 5 5];
b=[1 1 5];
I would like to delete two 1's and one 5 from 'a' (as in 'b') to get the result:
c=[1 2 3 3 5 5 5];
Thanks!

回答 (1 件)

Naty S
Naty S 2015 年 7 月 19 日
You'll need to find the indexes which you want to keep. After you got the indexes just type c= A(desired indexes). e.g c= A(3:9)
The more tricky question is how to decide which indexes you want to delete. Probably could use the find function help you do that. http://www.mathworks.com/help/matlab/ref/find.html
The more tricky question

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by