Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/KPMtools/cell2matPad.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function data2 = cell2matPad(data) |
wolffd@0 | 2 % data{f}(y,x,b) - each frame can have a different size (can can even be empty) |
wolffd@0 | 3 % data2(y,x,b,f) = zero padded version |
wolffd@0 | 4 |
wolffd@0 | 5 Nframes = length(data); |
wolffd@0 | 6 Nbands = -inf; |
wolffd@0 | 7 nr = -inf; nc = -inf; |
wolffd@0 | 8 for f=1:Nframes |
wolffd@0 | 9 if isempty(data{f}), continue; end |
wolffd@0 | 10 nr = max(nr, size(data{f},1)); |
wolffd@0 | 11 nc = max(nc, size(data{f},2)); |
wolffd@0 | 12 Nbands = max(Nbands, size(data{f},3)); |
wolffd@0 | 13 end |
wolffd@0 | 14 data2 = zeros(nr, nc, Nbands, Nframes); |
wolffd@0 | 15 for f=1:Nframes |
wolffd@0 | 16 if isempty(data{f}), continue; end |
wolffd@0 | 17 data2(1:size(data{f},1), 1:size(data{f},2), :, f) = data{f}; |
wolffd@0 | 18 end |
wolffd@0 | 19 if Nbands == 1 |
wolffd@0 | 20 data2 = squeeze(data2); % reshape(data2, [size(data2,1), size(data2,2), Nframes]); |
wolffd@0 | 21 end |
wolffd@0 | 22 |