Borrar filtros
Borrar filtros

Combining two matrices in the correct original order

1 visualización (últimos 30 días)
george masters
george masters el 31 de Ag. de 2022
Editada: Image Analyst el 1 de Sept. de 2022
I have one matrix of random intergers (x) which I have spilt into two matrices (A) and (B). I have then converted to binary, then manipulated it and I got back the original matrices A and B represented by r and rr.
How can I recombine the matrices r and rr to get back to the original matrix A?
close all; clc; clear all;
%% Generation
x=randi([1,128],128,128);
A=x(1:2:end,1:2:end,:);
a=de2bi(A,8).';
a=a(:);
Na=length(a);
B=x(2:2:end,2:2:end,:);
b=de2bi(B,8).';
b=b(:);
Nb=length(b);
%%% other processing %%%
%% get back original sqeuence
r=reshape(a,8,[])';
ss=bi2de(r)';
r=reshape(ss,64,64);
rr=reshape(b,8,[])';
s=bi2de(rr)';
rr=reshape(s,64,64);

Respuesta aceptada

David Hill
David Hill el 31 de Ag. de 2022
x=randi([1,128],128,128);%16,384 elements
A=x(1:2:end,1:2:end,:);%4,096 elements
B=x(2:2:end,2:2:end,:);%4,096 elements
Combining A and B will never give you back x.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating 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