MATLAB: I want to cut the array [-180:1:180]. with values from 10 to 20. How to do that

arraymatrix manipulation

I am plotting my values from 10 to 20 from a data set of -180 to 180 with 1 unit increase. how to cut array with values not with index.

Best Answer

mask = 10 <= t & t <= 20;
selected_t = data(t);
corresponding_data = y(mask);
plot(selected_t, corresponding_data)