フィルターのクリア

How to delete multiple portions (not consecutive) inside a vector? For example:

1 回表示 (過去 30 日間)
V. Luong
V. Luong 2018 年 1 月 16 日
回答済み: Birdman 2018 年 1 月 17 日
Here is the problem, please help me solve it without using for loops. Many Thanks!
Given vector V, indice vector I(mx2). How to delete chains of values inside V such that each chain starts at I(i,1) and ends at I(i,2), with i = 1~m? For example:
If
V = [2 1 48 8 4 8 14 6 8]
I = [1 3; 5 7; 9 9]
Then
V([1 2 3 5 6 7 9]) = []
> V = [8 6]

回答 (1 件)

Birdman
Birdman 2018 年 1 月 17 日
You may convert I into a column vector and do the following:
V(I(:))=[]

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by