Azzera filtri
Azzera filtri

transform a 3x1 cell array containing {2x4}cell arrays into 2x1 cell array containing {3x4}cell arrays

1 visualizzazione (ultimi 30 giorni)
C={ {[36 16 1 16 36] [20 12 2 12 22] [13 43 33 3 33 43 13] [19 4 19]
[40 20 5 20 40] [26 16 6 16 26] [17 47 37 7 37 47 17] [23 8 23]}
{[1 2 3 ] [4 5 6 7 8 9] [ 10 11 12 13 14 15 16 17 ] [18 19 20 21 22]
[23 24 25 26 27 28 29] [30 31 32] [33 34 35 36 37] [38 39 40 41 42]}
{[10 20 30 40 55 ] [66 77 88 99 111 122 133] [ 144 155 166 ] [177 188 199]
[222 233 244 255 266 ] [277 288 299 333 344 ] [355 366 377] [388 399 411 422 433]}
};
Tried using
U=cell2mat(C);
Result = mat2cell(U, c*ones(1,2), 4);
Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.
Is there another function to do this? And how to do it for 10x1 {401x1300} to 401x {10x1300}?

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 30 Nov 2017
out = mat2cell(cat(1,C{:}),[3 3],4)
  1 Commento
Joseph Lee
Joseph Lee il 30 Nov 2017
Modificato: Joseph Lee il 30 Nov 2017
Error using mat2cell (line 89) Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [4010 1300].
out =mat2cell(cat(C{:}),[10 10],1300);
what is wrong here? should the [10 10] be [10 10 10 10.... x401]?
Just solved it using repmat(10,401,1)

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Types 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!

Translated by