Effacer les filtres
Effacer les filtres

Combining two matrices in the correct original order

1 vue (au cours des 30 derniers jours)
george masters
george masters le 31 Août 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);

Réponse acceptée

David Hill
David Hill le 31 Août 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.

Plus de réponses (0)

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by