MATLAB: How to extract data from a vector based on index

find index

I have an index and a vector I would like to have data from the vector which is not in the index!For example
A=[5 3 7 8 89 6]
index=[2 3 4 5]
Now I want to have B as my answer B=[5 6] Thanks!

Best Answer

B = A(setdiff((1:length(A)).,index(:)));
or if you're sure A and index are row vectors just
B = A(setdiff(1:length(A),index));