```python
def sort_matrix(M):
    """
    Sorts a given matrix in ascending order according to the sum of its rows.

    Args:
        M (list of list of int/float): The matrix to be sorted.

    Returns:
        list of list of int/float: The sorted matrix.
    """
    return sorted(M, key=sum)

```