MATLAB, Removing Certain Elements From An Array That Fits The Condition
This code removes all elements that have diff 3 or less to the previous element.

in = [3 6 10 14 17 20 24 25 30 34 38]
in1 = in(2:end);
D = diff(in)
out = [in(1) in1(D &gt; 3)]


output:

in =

     3     6    10    14    17    20    24    25    30    34    38


D =

     3     4     4     3     3     4     1     5     4     4


out =

     3    10    14    24    30    34    38