Reading nData into MATLAB

To read a binary nData (.nd) file into MATLAB, use the following .m file:


Example usage:

    nd = nd_read('zz.nd');

This will create a MATLAB struct with the following organization:

  nd.class          - (string) Description of file class
  nd.nconst         - (int) Number of constant parameters
  nd.nvar           - (int) Number of variable parameters
  nd.ntable         - (int) Number of event code tables [not yet implemented]
  nd.ntrial         - (int) Number of trials

  nd.const(i).name  - (string) Name of ith constant parameter, i=1..nd.nconst
  nd.const(i).val   - (string) Value of ith constant parameter
  nd.const(i).type  - (char) Type of ith constant parameter, e.g., i, f, c for
                      int, float, char, respectively.

  nd.var(i).name    - (string) Name of ith variable parameter, i=1..nd.nvar
  nd.var(i).type    - (char) Type of ith variable parameter, e.g., i, f, c for
                      int, float, char, respectively.    - (int) Trial code for ith trial i=1..nd.ntrial     - (int) Time reference for ith trial   - (int) Number of variable parameter values for ith trial     - (int) Number of records (i.e., channels) for ith trial - (string) Name of jth param,  - (string) Value of jth param.
                         NOTE:  These are the values for the variable params
                         whose names and types are stored in nd.var()... above.    - (int) Record type, 0-spikes, 1-float, 2-point value     - (string) Record name, e.g., 'lgn_0_0_0', etc...    - (int) Record code - (float) Sampling rate, e.g., 1000.0 = msec       - (int) Time origin for recorded spikes, e.g., 0       - (int) Time duration for recording, e.g., 2048        - (int) Number of spikes  - (int) spike times (for spike data) - (int) float values (for continuous data)