MATLAB: Cut vector in set range

rangevectors

I have about 10 thousand vectors and I want to cut them all to special range set by my min and max . eg. have only vectors from 600 – 1000 values How to implement it in the best efficient way.

Best Answer

Try this for each of the vectors:
minValue = 600; % Or whatever you want.

maxValue = 1000; % Or whatever you want.
indexesInRange = data > minValue & data < maxValue;
subVector = data(indexesInRange);
That will, for a vector called data, extract all the values between minValue (which you can define to be 600) and maxValue (which you can define to be 1000) into a new vector called subVector. Do this 10 thousand times for each of the vectors (most likely done in a loop).
Related Question