I have restated my question even further:(adsbygoogle = window.adsbygoogle || []).push({});

Suppose I have a sorted matrix:

[ 0 0 0 1 1 1 1 3 3 3 5 6 7 8 9 9 ]

I need to remove the last value in the matrix until the number of entries that are greater than one equal the number of entries that are either 0 or 1. For the example given above, there are 16 entries. Nine entries are greater than 1 and 7 entries are less than or equal to one. I would need to remove the last two entries such that the number of entries that are greater than one equal the number of entries that are either 0 or 1.

What if I have a much larger set of values? How do code this in MATLAB?

Thanks!

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB help!

**Physics Forums | Science Articles, Homework Help, Discussion**