cerebus采集的NS6格式数据matlab读取函数openNSx说明

openNSx
  
  Opens and reads an NSx file then returns all file information in a NSx
  structure. Works with File Spec 2.1, 2.2, 2.3, and 3.0.
  Use OUTPUT = openNSx(fname, 'read', 'report', 'e:xx:xx', 'c:xx:xx', 't:xx:xx', 'mode', 'precision', 'skipfactor', 'nozeropad').
  
  All input arguments are optional. Input arguments can be in any order.
 
    fname:        Name of the file to be opened. If the fname is omitted
                  the user will be prompted to select a file. 
                  DEFAULT: Will open Open File UI.
 
    'read':       Will read the data in addition to the header information
                  if user passes this argument.
                  DEFAULT: will read the entire file.
 
    'report':     Will show a summary report if user passes this argument.
                  DEFAULT: will not show report.
 
    'e:XX:YY':    User can specify which electrodes need to be read. The
                  number of electrodes can be greater than or equal to 1
                  and less than or equal to 256. The electrodes can be
                  selected either by specifying a range (e.g. 20:45) or by
                  indicating individual electrodes (e.g. 3,6,7,90) or both.
                  Note that, when individual channels are to be read, all
                  channels in between will also be read. The prorgam will
                  then remove the unwanted channels. This may result in a
                  large memory footprint. If memory issues arrise please
                  consider placing openNSx in a for loop and reading
                  individual channels.
                  This field needs to be preceded by the prefix 'e:'. See
                  example for more details. If this option is selected the
                  user will be promped for a CMP mapfile (see: KTUEAMapFile)
                  provided by Blackrock Microsystems. This feature required
                  KTUEAMapFile to be present in path.
                  DEFAULT: will read all existing electrodes.
用户可以指定需要读取的电极。电极个数可以大于等于1,小于等于256。电极可以通过指定范围(例如20:45)或通过指示单个电极(例如3、6、7、90)或两者同时选择。请注意,当读取单个通道时,也将读取中间的所有通道。然后程序将删除不需要的频道。这可能会导致大量内存占用。如果出现内存问题,请考虑将openNSx放在for循环中并读取单个通道。该字段需要在前面加上前缀“e:”。有关更多细节,请参见示例。如果选择此选项,用户将被提示使用贝莱德微系统提供的CMP地图文件(参见:KTUEAMapFile)。这个特性需要KTUEAMapFile存在于path中。默认:将读取所有现有电极
 
    'c:XX:YY':    User can specify which channels need to be read. The
                  number of channels can be greater than or equal to 1
                  and less than or equal to 272. The channels can be
                  selected either by specifying a range (e.g. 20:45) or by
                  indicating individual channels (e.g. 3,6,7,90) or both.
                  Note that, when individual channels are to be read, all
                  channels in between will also be read. The prorgam will
                  then remove the unwanted channels. This may result in a
                  large memory footprint. If memory issues arrise please
                  consider placing openNSx in a for loop and reading
                  individual channels.
                  This field needs to be preceded by the prefix 'c:'. See
                  example for more details.
                  DEFAULT: will read all existing analog channels.
用户可以指定需要读取哪些通道。通道数可以大于等于1,小于等于272。通道可以通过指定范围(例如20:45)或通过指示单个通道(例如3,6,7,90)或两者同时选择。请注意,当读取单个通道时,也将读取中间的所有通道。然后程序将删除不需要的频道。这可能会导致大量内存占用。如果出现内存问题,请考虑将openNSx放在for循环中并读取单个通道。该字段需要在前面加上前缀“c:”。有关更多细节,请参见示例。默认:将读取所有现有的模拟通道。
 
    't:XX:YY':    User can specify the beginning and end of the data
                  segment to be read. If the start time is greater than the
                  length of data the program will exit with an errorNS
                  message. If the end time is greater than the length of
                  data the end packet will be selected for end of data. The
                  user can specify the start and end values by comma 
                  (e.g. [20,50]) or by a colon (e.g. [20:50]). To use this
                  argument the user must specify the [electrodes] or the
                  interval will be used for [electrodes] automatically.
                  This field needs to be preceded by the prefix 't:'. 
                  Note that if 'mode' is 'sample' the start duration cannot
                  be less than 1. The duration is inclusive.
                  See example for more details.
                  DEFAULT: will read the entire file.
't:XX:YY':用户可以指定要读取的数据段的开始和结束。如果开始时间大于数据长度,程序将退出并显示errorNS消息。如果结束时间大于数据长度,则选择结束报文作为数据结束。用户可以使用逗号(例如[20,50])或冒号(例如[20:50])指定起始值和结束值。要使用此参数,用户必须指定[电极],否则间隔将自动用于[电极]。该字段需要在前面加上前缀“t:”。请注意,如果'mode'是'sample',则开始持续时间不能小于1。持续时间包括在内。有关更多细节,请参见示例。默认:将读取整个文件。
 
    'mode':       The user can specify the mode of duration in [duration],
                  such as 'sec', 'min', 'hour', or 'sample'. If 'sec' is
                  specified the numbers in [duration] will correspond to
                  the number of seconds. The same is true for 'min', 'hour'
                  and 'sample'.
                  DEFAULT: reads 'sample'.
'mode':用户可以在[duration]中指定持续时间的模式,例如'sec', 'min', 'hour'或'sample'。如果指定了'sec',则[duration]中的数字将对应秒数。'min', 'hour'和'sample'也是如此。默认:读取'sample'。
 
    'uV':         Will read the recording waveforms in unit of uV instead of
                  raw values. Note that this conversion may lead to loss of
                  information (e.g. 15/4 = 4) since the data type will
                  stay in int16. It's recommended to read raw spike
                  waveforms and then perform the conversion at a later
                  time.
                  DEFAULT: will read recording information in raw.
'uV':将以uV为单位读取记录波形,而不是原始值。注意,这种转换可能会导致信息丢失(例如15/4 = 4),因为数据类型将保留在int16中。建议读取原始尖峰波形,然后在稍后的时间执行转换。默认:将以raw格式读取记录信息。
 
    'precision':  This will specify the precision for NSx file. If set to
                  'double' the NSx data will be read as 'double' and if set
                  to 'short', the NSx data will be read as 'int16' data
                  type. While reading the file as 'short' may have a much
                  smaller memory footprint and a faster read time, some 
                  post data analysis such as multiplying the signal by a 
                  factor that will make the data larger than (-32,768 to 
                  32,767 -- refer to MATLAB documentation for more 
                  information) may result in unexpected behavior. 
                  Always use caution when using short. If you are not sure
                  of what to use then do not specify this option.
                  DEFAULT: will read data in 'int16'.
'precision':这将指定NSx文件的精度。如果设置为'double', NSx数据将被读取为'double',如果设置为'short', NSx数据将被读取为'int16'数据类型。虽然将文件读取为“短”可能具有更小的内存占用和更快的读取时间,但一些后数据分析,例如将信号乘以将使数据大于(-32,768至32,767 -请参阅MATLAB文档了解更多信息)的因子可能会导致意外行为。使用缩写时一定要小心。如果您不确定使用什么,则不要指定此选项。默认:将读取'int16'中的数据。
 
    'skipfactor': This option will allow the user to read a decimated
                  version of the data. The skipfactor will determine how
                  many samples to skip. For example, if skipfactor is 2
                  then every other sample is read. If skipfactor is 5 then
                  every fifth sample is read. This is useful to briefly
                  looking at the data in a large datafile when reading the
                  entire dataset would overflow the memory.
                  DEFAULT: is set to 1, so every sample will be read.
'skipfactor':该选项将允许用户读取数据的抽取版本。跳过因子将决定要跳过多少样本。例如,如果skipfactor为2,则读取所有其他样本。如果skipfactor为5,则读取每5个样本。当读取整个数据集会使内存溢出时,这对于简单地查看大型数据文件中的数据非常有用。DEFAULT:设置为1,因此将读取每个样本。
 
    'ver':        If this argument is passed to the function it will return
                  the version number of the function without reading any
                  data files.
'ver':如果将此参数传递给函数,它将返回函数的版本号,而不读取任何数据文件。
 
    'nozeropad':  It will not zeropad the data to compensate foro the non-
                  zero start time.
                  DEFAULT: zeropads the loaded data.
它不会将数据归零以补偿非零开始时间。DEFAULT:将加载的数据归零。
 
    OUTPUT:       Contains the NSx structure.
输出:包含NSx结构。
 
    Example 1: 
    openNSx('report','read','c:datasample.ns5', 'e:15:30', 't:3:10','min', 'p:short', 's:5');
 
    or equivalently
    openNSx('report','read','c:datasample.ns5', 'electrodes', 15:30, 'duration', 3:10, 'min', 'precision', 'short', 'skipfactor', 5);
 
    In the example above, the file c:datasample.ns5 will be used. A
    report of the file contents will be shown. The data will be read from
    electrodes 15 through 50 in the 3-10 minute time interval. A decimated 
    version of the datafile will be read, where only every 5th sample is read.
    If any of the arguments above are omitted the default values will be used.
在上面的例子中,文件c:datasample。将使用Ns5。将显示文件内容的报告。数据将在3-10分钟的时间间隔内从电极15到50读取。将读取数据文件的抽取版本,其中仅读取每5个样本。如果省略上述任何参数,将使用默认值。
 
    Example 2:
    openNSx('read','c:15:30');
 
    In the example above, the file user will be prompted for the file. The
    file will be read using 'int16' precision as default. All time points 
    of Only channels 15 through 30 will be read. If any of the arguments 
    above are omitted the default values will be used.
在上面的示例中,将提示文件用户输入文件。该文件将默认使用'int16'精度读取。只有15至30频道的所有时间点将被读取。如果省略上述任何参数,将使用默认值。
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Kian Torab
    [email protected]
    Blackrock Microsystems
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%