


d = reshapeRegisters(d) This function reshapes all the registers in d, calling itself recursively. Oliver King, Jan 2010 modified sjcm Nov to make sure it doesn't assume the 3rd dimension is time.


0001 function d = reshapeRegisters(d) 0002 % d = reshapeRegisters(d) 0003 % This function reshapes all the registers in d, calling itself 0004 % recursively. 0005 % 0006 % Oliver King, Jan 2010 0007 % modified sjcm Nov to make sure it doesn't assume the 3rd dimension is time. 0008 0009 if isstruct(d) 0010 % Call reshapeRegisters on each field 0011 nlist = fieldnames(d); 0012 for k=1:length(nlist) 0013 d.(nlist{k}) = reshapeRegisters(d.(nlist{k})); 0014 end 0015 else 0016 % Applies a standard reshape to the register. 0017 if size(d,3) > 100 % don't like this fudge! Adds lines to my concise function :) 0018 d = d(:,:,1:100); 0019 end 0020 if(size(d,3) ~= 3) 0021 d = reshape(permute(d,[3 1 2]),size(d,3)*size(d,1),size(d,2),1); 0022 end 0023 0024 end 0025 0026 return;