comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function data2 = cell2matPad(data)
2 % data{f}(y,x,b) - each frame can have a different size (can can even be empty)
3 % data2(y,x,b,f) = zero padded version
4
5 Nframes = length(data);
6 Nbands = -inf;
7 nr = -inf; nc = -inf;
8 for f=1:Nframes
9 if isempty(data{f}), continue; end
10 nr = max(nr, size(data{f},1));
11 nc = max(nc, size(data{f},2));
12 Nbands = max(Nbands, size(data{f},3));
13 end
14 data2 = zeros(nr, nc, Nbands, Nframes);
15 for f=1:Nframes
16 if isempty(data{f}), continue; end
17 data2(1:size(data{f},1), 1:size(data{f},2), :, f) = data{f};
18 end
19 if Nbands == 1
20 data2 = squeeze(data2); % reshape(data2, [size(data2,1), size(data2,2), Nframes]);
21 end
22