Is there anyway to retrieve the original matrix from randomised matrix ? I used randperm function to randomised the code

조회 수: 1 (최근 30일)
CLC;
Clear all;
Close all;
A=[ 1 2 3;2 3 4;3 4 5];
[M,N] = size(A);
F= randperm(N);
B=A;
for i=1:M
if(i<=M)
B(i,F)=A(i,:);
i=i+1;
end
end
disp(B);
  댓글 수: 7
Walter Roberson
Walter Roberson 2019년 6월 27일
When you go to do the recovery, what values are you permitted to use as input?

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 6월 27일
You cannot do that.
You are permuting the columns, so you do not have to worry about the full matrix size: if you could work out any one row then you could apply that to all of the rows.
So consider one row of input. You permute it and know the result. To get back you would need to permute it back. But consider the examples:
A1=4 6 5, F1 = 3 1 2, B = 5 4 6
A2=6 4 5, F2 = 3 2 1, B = 5 4 6
You have the same B result for two different A, and therefore you cannot know whether to apply the inverse of F1 to get A1, or to apply the inverse of F2 to get A2.
Your sample A has the property that the first row is in increasing order. If we were permitted to rely on that then it would be easy to solve.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by