How to get back the original matrix?

4 visualizaciones (últimos 30 días)
Ammy
Ammy el 25 de Mzo. de 2022
Respondida: Torsten el 25 de Mzo. de 2022
A=[1 2 3 2;4 1 2 3;3 4 3 2;2 4 1 1];
>> R=[1 3 4 2];
>> B=A(R,:);
>> C=B(:)';
>> D=[1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1];
>> E=C(D==1);
Can we get back A?
  2 comentarios
KSSV
KSSV el 25 de Mzo. de 2022
Already you have A...
Ammy
Ammy el 25 de Mzo. de 2022
Yes But by the reverse process?

Iniciar sesión para comentar.

Respuesta aceptada

Torsten
Torsten el 25 de Mzo. de 2022
A = [1 2 3 2;...
4 1 2 3;...
3 4 3 2;...
2 4 1 1]
R = [1 3 4 2];
B = A(R,:);
Rinv(R) = 1:numel(R);
A_recovered = B(Rinv,:)

Más respuestas (1)

Chunru
Chunru el 25 de Mzo. de 2022
A=[1 2 3 2;4 1 2 3;3 4 3 2;2 4 1 1];
% Reordering the rows of A is reversible
R=[1 3 4 2];
B=A(R,:);
% Straightening up the matrix into vector is also reversible
C=B(:)';
% Picking up part of the data is not reversible
D=[1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1];
E=C(D==1);
  1 comentario
Ammy
Ammy el 25 de Mzo. de 2022
@Chunru thank you
How the following can be
reversible ,
A=[1 2 3 2;4 1 2 3;3 4 3 2;2 4 1 1];
% Reordering the rows of A is reversible
R=[1 3 4 2];
B=A(R,:);

Iniciar sesión para comentar.

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by