Skip to content

Commit

Permalink
Bug fix with splitNSx
Browse files Browse the repository at this point in the history
***** NPMK Version 4.3.1.0: July 2, 2016 *****

% splitNSx 1.1.0.0: July 2, 2016
%   - Fixed a bug related to a case where initial timestamp of the first
%     data segment was not 0.
  • Loading branch information
Kian Torab authored and Kian Torab committed Jul 3, 2016
1 parent e82c33d commit 0aba131
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
Binary file removed NPMK/.DS_Store
Binary file not shown.
23 changes: 20 additions & 3 deletions NPMK/NSx Utilities/splitNSx.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,22 @@ function splitNSx(splitCount)
% loaded file will be split in 4 samller files. For example, if the file
% is 1 hour long then it will be split into four 15-minute files.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Kian Torab
% ktorab@blackrockmicro.com
% support@blackrockmicro.com
% Blackrock Microsystems
% Version 1.0.3.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Version History
%
% 1.0.0.0:
% - Initial release.
%
% 1.1.0.0:
% - Fixed a bug related to a case where initial timestamp of the first
% data segment was not 0.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

% Validating input parameter
Expand Down Expand Up @@ -67,8 +79,8 @@ function splitNSx(splitCount)
% Calculating different points in the file
fseek(FID, 0, 'bof');
basicHeader = fread(FID, 314, '*uint8');
fseek(FID, 0, 'eof');
positionEOE = typecast(basicHeader(11:14), 'uint32');
fseek(FID, 0, 'eof');
positionEOD = ftell(FID);
% Calculating channelCount, data Length
channelCount = typecast(basicHeader(311:314), 'uint32');
Expand All @@ -92,6 +104,11 @@ function splitNSx(splitCount)
fprintf('Writing segment %d... ', idx);
% Writing the segmented data into file
fwrite(FIDw, fileHeader, 'char');
% Set the timestamp of the segments 2+ to 0 so there's no
% introduced shift by openNSx.
if idx > 1
dataHeader(2:5) = 0;
end
fwrite(FIDw, dataHeader, 'char');
fwrite(FIDw, dataSegment, 'char');
% Clearing variables and closing file
Expand Down
8 changes: 7 additions & 1 deletion NPMK/Versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,10 @@ NPMK Version 2.8.2.0: 5 May 2014
% - Fixed a bug with reading NeuroMotive data that resulted in a crash.
% - Improved and more detailed parsing of NeuroMotive events.
% - Added parsing of comment start time and comment commit time (time
% that a comment is entered.
% that a comment is entered.

***** NPMK Version 4.3.1.0: July 2, 2016 *****

% splitNSx 1.1.0.0: July 2, 2016
% - Fixed a bug related to a case where initial timestamp of the first
% data segment was not 0.

0 comments on commit 0aba131

Please sign in to comment.