Skip to content

ndr.format.binarymatrix.read

  READ - read a binary matrix file

  [DATA, TOTAL_SAMPLES, S0, S1] = READ(FILENAME_OR_FILEOBJ, NUM_CHANNELS, CHANNEL_INDEXES, S0, S1)

  Attempts to read binary data from a binary stream (can be a FILENAME or a FILEOBJ) from a
  binary matrix file. A binary matrix file is comprised of a vector of channels. Each sample
  consists of one value for each channel in the vector, followed by the next sample, etc.

  Inputs:
  ------
  NUM_CHANNELS - the number of channels that comprise the sample vector.
  CHANNEL_INDEXES - the index number of the channels to return. For example, 
    CHANNEL_INDEXES = [ 1 2 3] indicates that the data should only be returned from the first,
    second, and third channels in the matrix. Note that these channels may correspond to
    different physical channels, depending upon how the data was recorded. CHANNEL_INDEXES refer
    to indexes of the channels within the file.
  S0 - the sample number at which to start reading (number starting from 1). Can be -inf to indicate the start.
  S1 - the sample number at which to stop reading (number starting from 1). Can be inf to indicate the end.

  Outputs:
  -------
  DATA is an SxC matrix with samples in each row. For example, DATA(:,c) are all the samples requested
    from channel CHANNEL_INDEXES(c).
  TOTAL_SAMPLES - the number of total vector samples in the file.
  S0 - the sample number (from 1) where the reading started.
  S1 - the sample number (from 1) where the reading stopped.

  One may add optional arguments in the form of name/value pairs or inupt argument assignments.
  --------------------------------------------------------------------------------------------
  | Parameter (default)              | Description                                           |
  |--------------------------------- |-------------------------------------------------------|
  | dataType ('double')              | The data type of each value in the matrix.            |
  | byteOrder ('ieee-le')            | The byte order of the data (can be 'ieee-be' also)    |
  | force_single_channel_read (false)| Force the program to read channels 1 by 1 (may be     |
  |                                  |   slower but sometimes helpful for debugging)         |
  | headerSkip (0)                   | Number of header bytes to skip.                       |
  |----------------------------------|-------------------------------------------------------|