What you want is called set difference in most languages. In MATLAB, you can use the setdiff
function:
a=1:20;
>> b=[2,7,12,18];
>> setdiff(a,b);
ans =
Columns 1 through 11
1 3 4 5 6 8 9 10 11 13 14
Columns 12 through 16
15 16 17 19 20