diff --git a/NPMK/Other tools/settingsManager.m b/NPMK/Other tools/settingsManager.m index ec68c2a..4e96e28 100644 --- a/NPMK/Other tools/settingsManager.m +++ b/NPMK/Other tools/settingsManager.m @@ -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. diff --git a/NPMK/Versions.txt b/NPMK/Versions.txt index dc23ece..6fdc19d 100644 --- a/NPMK/Versions.txt +++ b/NPMK/Versions.txt @@ -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. diff --git a/NPMK/openNSx.m b/NPMK/openNSx.m index f819bf3..71d2442 100644 --- a/NPMK/openNSx.m +++ b/NPMK/openNSx.m @@ -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. @@ -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'); @@ -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); @@ -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