Randomizing the rows of a matrix and reversing

조회 수: 3 (최근 30일)
Mohsin Shah
Mohsin Shah 2017년 8월 1일
댓글: Mohsin Shah 2017년 8월 2일
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:
The above code doesn't produce the original matrix. Can someone highlight my mistake and give me a solution?

채택된 답변

José-Luis
José-Luis 2017년 8월 1일
편집: José-Luis 2017년 8월 1일
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
José-Luis
José-Luis 2017년 8월 1일
편집: José-Luis 2017년 8월 1일
Then you need to pass the two indexes or the state of your random number generator to recreate them.
That being said, this does not feel like the best way of hiding data, but what do I know :)
Mohsin Shah
Mohsin Shah 2017년 8월 2일
Thank you so much. This is only to permute the locations for achieving more security. The hiding itself is a complex algorithm and has nothing to do with permutation.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by