Error in following code while converting cell to matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Error in following code
Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.
Error in Fusion_Minutie_InvMoment (line 18)
fusion = cell2mat(out);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
V = {load('db1.mat'),load('db2.mat'),load('db3.mat'),load('db4.mat')};
n = cellfun(@fieldnames,V,'un',0);
V1 = cellfun(@(x,y)[x.(y)]',V,[n{:}],'un',0);
V2 = [V1{:}];
V3 = cell2mat(reshape(V2,1200,[]));
V4 = mat2cell(V3,4*ones(size(V3,1)/4,1),7);
out = mat2cell(V4,[400,800],1);
fusion = cell2mat(out);
0 Commenti
Risposte (2)
Majid Farzaneh
il 21 Giu 2018
Hi, you can do it like this:
V = {load('db1.mat'),load('db2.mat'),load('db3.mat'),load('db4.mat')};
n = cellfun(@fieldnames,V,'un',0);
V1 = cellfun(@(x,y)[x.(y)]',V,[n{:}],'un',0);
V2 = [V1{:}];
V3 = cell2mat(reshape(V2,1200,[]));
V4 = mat2cell(V3,4*ones(size(V3,1)/4,1),7);
out = mat2cell(V4,[400,800],1)
fusion1 = cell2mat(out{1});
fusion2= cell2mat(out{2});
fusion=[fusion1;fusion2];
In your cell matrix (out) there are 2 other cell matrix. For using cell2mat you should have normal matrix in 'out' cell matrix.
Andrei Bobrov
il 22 Giu 2018
Modificato: Andrei Bobrov
il 22 Giu 2018
fusion = cell2mat(cat(1,out{:}));
or just
V = {load('db1.mat'),load('db2.mat'),load('db3.mat'),load('db4.mat')};
n = cellfun(@fieldnames,V,'un',0);
V1 = cellfun(@(x,y)[x.(y)],V,[n{:}],'un',0);
fusion = cell2mat(reshape(cat(1,V1{:}),1200,[]));
Vedere anche
Categorie
Scopri di più su Power Converters in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!