Creates a padded data matrix from input structural array of spike times pads with NaN Usage: data=padNaN(data) Input: data : structural array of spike times Output: data : data matrix (zero padded)
0001 function data=padNaN(data) 0002 % Creates a padded data matrix from input structural array of spike times 0003 % pads with NaN 0004 % Usage: data=padNaN(data) 0005 % Input: 0006 % data : structural array of spike times 0007 % Output: 0008 % data : data matrix (zero padded) 0009 NC=length(data); 0010 fnames=fieldnames(data); 0011 for c=1:NC; 0012 eval(['Nsp(c)=length(data(c).' fnames{1} ');']); 0013 end; 0014 dtmp(1:max(Nsp),1:NC)=NaN; 0015 for c=1:NC; 0016 eval(['f=data(c).' fnames{1} ';']) 0017 dtmp(1:Nsp(c),c)=f; 0018 end; 0019 data=dtmp;