How to get back the original matrix with indices of matrix?

1 visualización (últimos 30 días)
Ammy
Ammy el 21 de Ag. de 2021
Comentada: Awais Saeed el 21 de Ag. de 2021
Let
A=reshape (1:16 ,4,4);
B1 = A(1:2:end, 1:2:end);
B2 = A(1:2:end, 2:2:end);
B3= A(2:2:end, 1:2:end);
B4 = A(2:2:end, 2:2:end);
How can I get back A with B1, B2,B3, and B4

Respuesta aceptada

Awais Saeed
Awais Saeed el 21 de Ag. de 2021
clc;clear all;close all
A=reshape (1:16 ,4,4); % 4x4 matrix
B1 = A(1:2:end, 1:2:end);
B2 = A(1:2:end, 2:2:end);
B3= A(2:2:end, 1:2:end);
B4 = A(2:2:end, 2:2:end);
c = reshape([B1 B2 B3 B4].', 4,4)';
c(:,[2,3]) = c(:,[3,2]) % swap columns

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by