Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to select a range of numbers in MATLAB?

I am working on a program in MATLAB in which I am trying to group certain ranges of numbers in a matrix into bins. I am trying to figure out how to do that. I think this would be better explained with an example. If A = [5.16,3.21,6.87,9.11,2.55,2.90,1.46,4.67,8.29] I want to create 5 bins. b1 is the numbers in A between 1 and 2, b2 is the numbers in A between 2 and 3, b3 is the numbers in A between 3 and 4, etc. Does anyone have any idea how I would go about doing this?

1 Answer

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    A = [5.16, 3.21, 6.87, 9.11, 2.55, 2.90, 1.46, 4.67]

    b1 = A(A>=1 & A<2)

    b2 = A(A>=2 & A<3)

    ...

Still have questions? Get your answers by asking now.