Combining two matrices in the correct original order
1 回表示 (過去 30 日間)
古いコメントを表示
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);
0 件のコメント
採用された回答
David Hill
2022 年 8 月 31 日
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.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!