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 - The Fusion of Science and Community**

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

# MATLAB help!

Loading...

Similar Threads - MATLAB help | Date |
---|---|

Matlab MATLab: Not enough inputs for nlinfit | Nov 16, 2017 |

Matlab Help needed to fix a matlab code | Nov 8, 2017 |

New to Matlab, help with vectors | Feb 20, 2016 |

Need help with integral | Dec 23, 2015 |

Communication between Arduino and Matlab Help | Jun 19, 2015 |

**Physics Forums - The Fusion of Science and Community**