MATLAB, extracting and saving values in a vector between 0 and 5, then 5 and 10, and so on -


i have column vector of values between 0 , 180. i'm looking way extract values columns between 0 , 5, values between 5 , 10 , on 180, , save these cell array.

i'm aware can use sort of technique:

range = data(5 <= data & data <= 10)  

but seems little long winded write out each range

the straightforward approach wrap code loop, this:

maxvalue = 180; data = randperm(maxvalue);   %//some dummy data binsize = 5; numbins = maxvalue / binsize; ranges = cell(1, numbins);  = 1:numbins      ranges{i} = data(binsize  * (i - 1) <= data & data <= binsize  * i); end 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -