Skip to content

Commit

Permalink
remove some small obvious issues
Browse files Browse the repository at this point in the history
  • Loading branch information
raltodo committed Nov 25, 2024
1 parent 8ed96fd commit 19d32d0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 40 deletions.
4 changes: 0 additions & 4 deletions brainStates/SleepScoreMaster/ConvertTwoLFPFilessToOne.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
72 changes: 36 additions & 36 deletions brainStates/SleepScoreMaster/private/readmulti_ss.m
Original file line number Diff line number Diff line change
@@ -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';

0 comments on commit 19d32d0

Please sign in to comment.