MATLAB: How to remove elements divisible by 3,4, and 5 in a vector

divisiblevector

I've created a vector x = 1:50 but I'm having trouble in how I can remove elements divisible by 3, 4, and 5, and then display it in a new vector. Thank you!

Best Answer

x = 1:50;
x([3:3:50,4:4:50,5:5:50]) = []