MATLAB: How to delete the same element in matrix

MATLABmatrixmatrix manipulation

i have a matrix
if true
B = input('enter the element to delete(enter any one 1,2,5,8,6,)= ')
A = [1 2 5 8 6];
end
When i enter any one of the number in the input, then delete that element in the matrix. how can i do please help.

Best Answer

A(A==B) = [];
or
A = A(A ~= B);