tomwalters@0: % method of class @signal tomwalters@0: % function st=signal2spiketrain(sig) tomwalters@0: % INPUT VALUES: tomwalters@0: % sig: original @signal tomwalters@0: % RETURN VALUE: tomwalters@0: % st: @spiketrain tomwalters@0: % bleeck@3: % This external file is included as part of the 'aim-mat' distribution package bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function st=signal2spiketrain(sig) tomwalters@0: % translates a signal in an spiketrain tomwalters@0: tomwalters@0: nr=getnrpoints(sig); tomwalters@0: vals=getvalues(sig); tomwalters@0: tomwalters@0: %spks=zeros(1000,1); tomwalters@0: tomwalters@0: count=1; tomwalters@0: for i=1:nr tomwalters@0: if vals(i)>0 tomwalters@0: for j=1:vals(i) tomwalters@0: %st=addspike(st,vals(i)); tomwalters@0: spks(count)=bin2time(sig,i); tomwalters@0: count=count+1; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: st=spiketrain(spks); tomwalters@0: tomwalters@0: tomwalters@0: