Can we change the size of cell inside the cell array?
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi there,
Will it be possible to change the size of the cell inside the cell array? For instance, consider a cell array of size 3X6 and each cell contains 6x1 matrix. Now what I want is a cell array of 1x6 and each cell should contains 6x3 matrix. Any help will be greatly appreciated.
0 Commenti
Risposta accettata
Voss
il 9 Giu 2022
Modificato: Voss
il 9 Giu 2022
% a cell array of size 3X6 and each cell contains 6x1 matrix
C = cell(3,6);
for ii = 1:size(C,1)
for jj = 1:size(C,2)
C{ii,jj} = rand(6,1);
end
end
disp(C);
[C{1,1} C{2,1} C{3,1}]
% what I want is a cell array of 1x6 and each cell should contains 6x3 matrix
C_new = cell(1,6);
for ii = 1:numel(C_new)
C_new{ii} = [C{:,ii}];
end
disp(C_new);
C_new{1}
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrices and Arrays 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!