by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.4, Creation date: 2023-11-03, Last change: 2025-09-15
A=unsortrows(A)
A: | Original matrix |
A: | unosrted matrix, randomly exchnanged rows |
A=sortrows(round(10*rand(10,4)),2), unsortrows(A)
The function unsortrows is designed to randomly shuffle the rows of a given matrix. It is a part of the SG-Library and was introduced in SolidGeometry 5.4. The function relies on another function called ELunsort to perform the actual row shuffling.
A but with its rows randomly exchanged. The function returns this unsorted matrix.An example usage of the function is provided in the comments:
A = sortrows(round(10*rand(10,4)),2); unsortrows(A);
In this example, a 10x4 matrix is generated with random values, sorted by the second column, and then passed to unsortrows to shuffle its rows.
The function unsortrows is a simple wrapper around the ELunsort function. It takes a matrix A as input and directly calls ELunsort(A) to perform the row shuffling. The shuffled matrix is then returned as the output.
There are no switch conditions or additional parameters in this function. The primary operation is the delegation of the task to ELunsort, which is assumed to handle the randomization of the matrix rows.