Randomizing the rows of a matrix and reversing
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mohsin Shah
el 1 de Ag. de 2017
Comentada: Mohsin Shah
el 2 de Ag. de 2017
Hello, I have a 988 x 3 matrix (say the vertices of 3D object) and I want to randomize the rows of this matrix and then do the reverse process to get the original matrix. I am using the following code to do the job:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166451/image.png)
The above code doesn't produce the original matrix. Can someone highlight my mistake and give me a solution?
0 comentarios
Respuesta aceptada
José-Luis
el 1 de Ag. de 2017
Editada: José-Luis
el 1 de Ag. de 2017
If you want to return to the original matrix, you need to keep it. There is no way to undo a random permutation, unless your data was ordered/structured in some way (was it?). If it was ordered, how so? The key word is random.
Just to be psychotic about it. randperm() is not random but pseudo-random. If you knew the state of the random number generator, it could be possible to go back to the original. I am guessing this is not what you had in mind.
8 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!