MATLAB: How to extract data to a certain number

data extraction

Say for example I have an array, x=(1:0.25:10) and I want only the data points up to a certain number. How would I do this?
Lest say I wanted all values up until I get the number 2.
(1,1.25,1.5, 1.75, 2) How could I extract just these numbers?

Best Answer

x(x<=2)