wolffd@0: function data2 = cell2matPad(data) wolffd@0: % data{f}(y,x,b) - each frame can have a different size (can can even be empty) wolffd@0: % data2(y,x,b,f) = zero padded version wolffd@0: wolffd@0: Nframes = length(data); wolffd@0: Nbands = -inf; wolffd@0: nr = -inf; nc = -inf; wolffd@0: for f=1:Nframes wolffd@0: if isempty(data{f}), continue; end wolffd@0: nr = max(nr, size(data{f},1)); wolffd@0: nc = max(nc, size(data{f},2)); wolffd@0: Nbands = max(Nbands, size(data{f},3)); wolffd@0: end wolffd@0: data2 = zeros(nr, nc, Nbands, Nframes); wolffd@0: for f=1:Nframes wolffd@0: if isempty(data{f}), continue; end wolffd@0: data2(1:size(data{f},1), 1:size(data{f},2), :, f) = data{f}; wolffd@0: end wolffd@0: if Nbands == 1 wolffd@0: data2 = squeeze(data2); % reshape(data2, [size(data2,1), size(data2,2), Nframes]); wolffd@0: end wolffd@0: