Filter löschen
Filter löschen

I have a cell array of size 1x934 and each cell has 160x160x96 double. I want to make a cell array of 1xn (n i think it is 89664) where each cell has 160x160

1 Ansicht (letzte 30 Tage)
I have a cell array of size 1x934 and each cell has 160x160x96 double. I want to make a cell array of 1xn (n i think it is 89664) where each cell has 160x160

Akzeptierte Antwort

Stephen23
Stephen23 am 19 Mär. 2018
Method one: concatenate into one numeric array, then split. This will not work of you do not have enough memory for the complete array. Where C is your cell array:
D = reshape(num2cell(cat(3,C{:}),1:2),1,[])
Method two: split into cell arrays, then concatenate. Does not require one large array to be sored in contiguous memory. Where C is your cell array:
D = cellfun(@(a)num2cell(a,1:2),C,'uni',0);
D = reshape(cat(3,D{:}),1,[]);

Weitere Antworten (1)

Andrei Bobrov
Andrei Bobrov am 19 Mär. 2018
out = squeeze(num2cell(cat(3,C{:}),[1,2]));

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by