Extract values within interquartile range in array
Show older comments
Hi,
I want to extract values within an interquartile range in an array. Let say that the array looks as follows: v= [1 2 3 4 5 6 ......95 96 97 98 99]. The interquartile range is 25 and 75. How can I extract the array values from 25 to 75 to a new array? If possible, can I select other ranges than bottom and top 25%?
Thanks!
Accepted Answer
More Answers (1)
madhan ravi
on 31 Oct 2018
Edited: madhan ravi
on 31 Oct 2018
v=1:100;
new_array = v(v >=25 & v<=75) %values between 25 to 75
new_array1 = v(v<25 | v>75) % values less than 25 and greater than 75
6 Comments
madhan ravi
on 31 Oct 2018
The extraction of ranges can be done by logical indexing.
Vlatko Milic
on 31 Oct 2018
Vlatko Milic
on 31 Oct 2018
madhan ravi
on 31 Oct 2018
Edited: madhan ravi
on 31 Oct 2018
Anytime :) couldn’t help you though because have no experience in statistics field :)
Vlatko Milic
on 31 Oct 2018
Sesilia Iileka
on 6 Mar 2019
Hi i want kind of the same thing but from a loop
like this:
for i = length(x)
xy = find(u==i | u>i & u4<(i+1)); #xy should find indices of u within that range i.e u(i)>=i<u(i+1)
N(i) = length(xy) #giving me counts of i
end
but then, the last iteration (last value of i) will be wrong by this expression.
how do i correct this please?
Thanks a lot
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!