Skip to content

Commit

Permalink
% openNSx 7.3.0.0: September 11, 2020
Browse files Browse the repository at this point in the history
%   - Fixed a bug related to fread and MATLAB 2020a.
%   - Gives a warning about FileSpec 3.0 and gives the user options for how 
%     to proceed.
%   - Added a warning about the data unit and that by default it in the
%     unit of 250 nV or 1/4 µV.
%   - If the units are in "raw", ths correct information is now written to
%     the electrodes header: 250 nV (raw).
  • Loading branch information
kianabc committed Sep 11, 2020
1 parent 63670e4 commit 2cb359a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NPMK/Other tools/settingsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@
if exist(fullPath, 'file') == 2
if length(varargin) == 0 % Load the settings file and send as output
varargout{1} = load(fullPath, '-mat');
try varargout{1}.checkeddate; catch varargout{1}.checkeddate = now; end
try varargout{1}.ShowZeroPadWarning; catch varargout{1}.ShowZeroPadWarning = 1; end
try varargout{1}.ShowuVWarning; catch varargout{1}.ShowuVWarning = 1; end
elseif length(varargin) == 1
checkeddate = varargin{1}.checkeddate;
ShowZeroPadWarning = varargin{1}.ShowZeroPadWarning;
ShowuVWarning = varargin{1}.ShowuVWarning;
save(fullPath, 'checkeddate', 'ShowZeroPadWarning'); % Save the settings file
end
else % Since it doesn't exist, create and save it.
Expand Down
6 changes: 5 additions & 1 deletion NPMK/Versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,14 @@ NPMK Version 2.8.2.0: 5 May 2014

***** NPMK Version 5.3.0.0 :September 11, 2020 *****
%
% openNSx 7.2.0.0: September 11, 2020
% openNSx 7.3.0.0: September 11, 2020
% - Fixed a bug related to fread and MATLAB 2020a.
% - Gives a warning about FileSpec 3.0 and gives the user options for how
% to proceed.
% - Added a warning about the data unit and that by default it in the
% unit of 250 nV or 1/4 �V.
% - If the units are in "raw", ths correct information is now written to
% the electrodes header: 250 nV (raw).
%
% settingsManager 1.0.0.0: September 11, 2020
% - Initial Release.
Expand Down
29 changes: 27 additions & 2 deletions NPMK/openNSx.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@
% 7.1.1.0: June 11, 2020
% - Fixed a bug related to fread and MATLAB 2020a.
%
% 7.3.0.0: September 11, 2020
% - Fixed a bug related to fread and MATLAB 2020a.
% - Gives a warning about FileSpec 3.0 and gives the user options for how
% to proceed.
% - Added a warning about the data unit and that by default it in the
% unit of 250 nV or 1/4 µV.
% - If the units are in "raw", ths correct information is now written to
% the electrodes header: 250 nV (raw).
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Defining the NSx data structure and sub-branches.
Expand Down Expand Up @@ -520,7 +529,11 @@
NSx.ElectrodesInfo(headerIDX).MaxDigiValue = typecast(ExtendedHeader((25:26)+offset), 'int16');
NSx.ElectrodesInfo(headerIDX).MinAnalogValue = typecast(ExtendedHeader((27:28)+offset), 'int16');
NSx.ElectrodesInfo(headerIDX).MaxAnalogValue = typecast(ExtendedHeader((29:30)+offset), 'int16');
NSx.ElectrodesInfo(headerIDX).AnalogUnits = char(ExtendedHeader((31:46)+offset))';
if strcmpi(waveformUnits, 'uV')
NSx.ElectrodesInfo(headerIDX).AnalogUnits = char(ExtendedHeader((31:46)+offset))';
else
NSx.ElectrodesInfo(headerIDX).AnalogUnits = '250 nV (raw) ';
end
NSx.ElectrodesInfo(headerIDX).HighFreqCorner = typecast(ExtendedHeader((47:50)+offset), 'uint32');
NSx.ElectrodesInfo(headerIDX).HighFreqOrder = typecast(ExtendedHeader((51:54)+offset), 'uint32');
NSx.ElectrodesInfo(headerIDX).HighFilterType = typecast(ExtendedHeader((55:56)+offset), 'uint16');
Expand Down Expand Up @@ -864,7 +877,7 @@
if strcmpi(response, 'n')
return;
end
response = input('Do you want NPMK to ask you about this every time? ', 's');
response = input('Do you want NPMK to continue to ask you about this every time? ', 's');
if strcmpi(response, 'n')
NPMKSettings.ShowZeroPadWarning = 0;
settingsManager(NPMKSettings);
Expand Down Expand Up @@ -902,6 +915,18 @@
else
NSx.Data = bsxfun(@rdivide, double(NSx.Data), 1./(double([NSx.ElectrodesInfo.MaxAnalogValue])./double([NSx.ElectrodesInfo.MaxDigiValue]))');
end % End of contribution
else
NPMKSettings = settingsManager;
if NPMKSettings.ShowuVWarning == 1
disp('The data is in unit of 1/4 µV. This mean that 100 in the NSx file equals to 25 µV. All values must be divided by 4.');
disp('To read the data in unit of µV, use openNSx(''uv''). For more information type: help openNSx');

response = input('Do you want NPMK to continue to ask you about this every time? ', 's');
if strcmpi(response, 'n')
NPMKSettings.ShowuVWarning = 0;
settingsManager(NPMKSettings);
end
end
end

%% Converting the data points in sample to seconds
Expand Down

0 comments on commit 2cb359a

Please sign in to comment.