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

1 vue (au cours des 30 derniers jours)
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 commentaires
Walter Roberson
Walter Roberson le 27 Juin 2019
When you go to do the recovery, what values are you permitted to use as input?
Nippulati Uday
Nippulati Uday le 27 Juin 2019
I can only use B matrix(randomised matrix) for recovery

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 27 Juin 2019
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.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by