I wish to separate the elements of a matrix on the basis of a certain criteria, say, all the elements that are greater than 50 should come at the end, in each row.(adsbygoogle = window.adsbygoogle || []).push({});

For example,

[45 36 78 89 12

54 23 46 71 21

31 41 67 92 19]

should become

[45 36 12 78 89

23 46 21 54 71

31 41 19 67 92]

The important thing here is that the relative order of the elements of a particular type (i.e. those greater or less than 50) should not change. So, in row 2, 54 should still be before 71 after the process is complete.

Assuming that I know the number of elements of each type in each row of the matrix, how do I write a program to accomplish this in MATLAB? I am quite clueless about how to proceed. Any help or suggestions would be most welcome.

**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!

# Matrix problem in MATLAB

Loading...

Similar Threads for Matrix problem MATLAB |
---|

MATLAB MATLAB: forces acting on an object |

Mathematica Summing matrix components |

MATLAB Does anyone had this plotting problem with MATLAB? |

Mathematica Solve Perturbation problem with mathematica |

Mathematica Eigenvectors 4x4 Matrix in Mathematica |

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