diff --git a/brainStates/SleepScoreMaster/ConvertTwoLFPFilessToOne.m b/brainStates/SleepScoreMaster/ConvertTwoLFPFilessToOne.m index cd507220..22361321 100755 --- a/brainStates/SleepScoreMaster/ConvertTwoLFPFilessToOne.m +++ b/brainStates/SleepScoreMaster/ConvertTwoLFPFilessToOne.m @@ -103,11 +103,7 @@ function ConvertTwoLFPFilessToOne(datasetfolder,recordingname,varargin) sf_LFP = sf_LFP./5; save(scorelfppath,'thLFP','swLFP','THchannum','SWchannum','sf_LFP'); -<<<<<<< HEAD % delete(swlfppath,thetalfppath) -======= - delete(swlfppath,thetalfppath) ->>>>>>> origin/master else display('LFP was not saved at 1250... bug?') keyboard diff --git a/brainStates/SleepScoreMaster/private/readmulti_ss.m b/brainStates/SleepScoreMaster/private/readmulti_ss.m index be31c69a..71d622e5 100755 --- a/brainStates/SleepScoreMaster/private/readmulti_ss.m +++ b/brainStates/SleepScoreMaster/private/readmulti_ss.m @@ -1,48 +1,48 @@ % reads multi-channel recording file to a matrix % function .lfp] = function readmulti(fname,numchannel,chselect) -% last argument is optional (if omitted, it will read all the +% last argument is optional (if omitted, it will read all the % channels -function .lfp] = readmulti_ss(fname,numchannel,chselect) +function lfp = readmulti_ss(fname,numchannel,chselect) if nargin == 2 - datafile = fopen(fname,'r'); - .lfp = fread(datafile,[numchannel,inf],'int16'); - fclose(datafile); - .lfp =.lfp'; - return + datafile = fopen(fname,'r'); + lfp = fread(datafile,[numchannel,inf],'int16'); + fclose(datafile); + lfp =lfp'; + return end if nargin == 3 - - % the real buffer will be buffersize * numch * 2 bytes - % (short = 2bytes) - - buffersize = 4096; - - % get file size, and calculate the number of samples per channel - fileinfo = dir(fname); - N_EL = ceil(fileinfo(1).bytes / 2 / numchannel); - - datafile = fopen(fname,'r'); - - mmm = sprintf('%d elements',N_EL); -% disp(mmm); - - .lfp=zeros(length(chselect),N_EL); - N_EL=0; - numelm=0; - while ~feof(datafile), - [data,count] = fread(datafile,[numchannel,buffersize],'int16'); - numelm = count/numchannel; - if numelm>0 % Kenji modified 061009.Otherwise if numelm == 0 an error occur. - .lfp(:,N_EL+1:N_EL+numelm) = data(chselect,:); - N_EL = N_EL+numelm; - end % Kenji modified 061009.Otherwise if numelm == 0 an error occur. -end -fclose(datafile); - + % the real buffer will be buffersize * numch * 2 bytes + % (short = 2bytes) + + buffersize = 4096; + + % get file size, and calculate the number of samples per channel + fileinfo = dir(fname); + N_EL = ceil(fileinfo(1).bytes / 2 / numchannel); + + datafile = fopen(fname,'r'); + + mmm = sprintf('%d elements',N_EL); + % disp(mmm); + + lfp=zeros(length(chselect),N_EL); + N_EL=0; + numelm=0; + while ~feof(datafile) + [data,count] = fread(datafile,[numchannel,buffersize],'int16'); + numelm = count/numchannel; + if numelm>0 % Kenji modified 061009.Otherwise if numelm == 0 an error occur. + lfp(:,N_EL+1:N_EL+numelm) = data(chselect,:); + N_EL = N_EL+numelm; + end % Kenji modified 061009.Otherwise if numelm == 0 an error occur. + + end + fclose(datafile); + end -eeg =.lfp'; +eeg = lfp';