comparison toolboxes/FullBNT-1.0.7/KPMtools/cell2matPad.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
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