How can I merge 4*4 cell arrays to form a 256*256 cell array?

3 vues (au cours des 30 derniers jours)
SMRITI
SMRITI le 21 Sep 2015
Réponse apportée : Matt J le 22 Sep 2015
Actually I took a plaintext image,converted that to 8 bit binary and then did DNA mapping. After that i splitted that into 4*4 cell arrays(each element of that cell looks like 'ATCG' or something ) and did some operation. Now I want to merge all those cells to get the final 256*256 cell?
  5 commentaires
SMRITI
SMRITI le 22 Sep 2015
Modifié(e) : Walter Roberson le 22 Sep 2015
a=imread('cameraman.tif');
%converting decimal matrix to binary
for i=1:1:256
for j=1:1:256
b{i,j,1} = dec2bin(a1(i,j),8);
end
end
%disp(b)
%DNA coding of plaintext image
plaintext_dna = bin2DNA(b);
size(plaintext_dna);
%----------------------------------------------------------
%STEP 2:
%DIVIDE PLAINTEXT DNA INTO SMALL BLOCKS OF 4*4
%---------------------------------------------------------
K=4;
c=K*ones(256/4, 1);
small_mat=mat2cell(plaintext_dna,c',c');
%size(small_mat);
%______________
%NOW I WANT TO MERGE small_mat to get back plaintext_dna........
SMRITI
SMRITI le 22 Sep 2015
Modifié(e) : Walter Roberson le 22 Sep 2015
function [ DNA_matrix] = bin2DNA( bin_matrix )
codebook = containers.Map({'00','11','10','01'},{'A','T','G','C'}); %// Lookup
outputCell = cellfun(@(x) values(codebook, {x(1:2),x(3:4),x(5:6),x(7:8)}), ...
bin_matrix, 'uni', 0);
DNA_matrix = cellfun(@cell2mat, outputCell, 'uni', 0);
end

Connectez-vous pour commenter.

Réponses (2)

Walter Roberson
Walter Roberson le 22 Sep 2015
cell256 = [small_mat1{1}, small_mat1{3}; small_mat1{2}; small_mat1{4}];

Matt J
Matt J le 22 Sep 2015
C=arrayfun(@(i) vertcat(small_mat{:,i}),1:64,'uni',0);
merged=[C{:}];

Catégories

En savoir plus sur Import, Export, and Conversion dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by