# Data Sorting (looking for a range that do not exist in a list of numbers)

2 ビュー (過去 30 日間)
Francis Kwofie 2019 年 11 月 30 日
Edited: Stephen Cobeldick 2019 年 11 月 30 日
Hi All,
Assume I have a column vector (please see attached) and it contains numbers but its not contineous. That is, say I have the numbers 1,2,3,6,7,8,23,24,25, 76,77 etc. I want to list the point where there was a jump, so in this case it will be 3,6 and 8,23 and 25,76.
Also after that, if possible, I would like to add '1' to the first value identified and substract '1' from the second value. For an illustration, 3,6 has been identified, so it will become 4,5. Which means among the numbers listed, 4 to 5 does not exist in the data and likewise 9 and 22 (in the case for 8,23) does not exist. I need these ranges that do not exists in the list of the numbers.
Any ideas?
Thank you

#### 0 件のコメント

サインイン to comment.

### 件の回答 (1)

Stephen Cobeldick 2019 年 11 月 30 日

>> V = [1,2,3,6,7,8,23,24,25,76,77];
>> X = diff(V)~=1;
>> B = V([X,false])+1 % missing range begin values
B =
4 9 26
>> E = V([false,X])-1 % missing range end values
E =
5 22 75

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

R2019b

Translated by