File variables – Multichannel Systems NeuroExplorer User Manual

Page 136

Advertising
background image

5.2. File Variables


The variables from the opened data file can be accessed using the prefix specifying the document.
For example, the spike train DSP01a from the active document can be addressed as:

doc.DSP01a


where doc is a reference to the document. You can get this reference by calling GetActiveDocument
or calling OpenDocument.


An alternative way to access a file variable is by getting a reference to the variable:

spikeTrain = GetVarByName(doc, "DSP01a")


Yet another way to access a file variable is by getting a reference to the variable via doc[VarName]
notation:

spikeTrainA = doc["DSP01a"]

name = "DSP01b"

spikeTrainB = doc[name]

Access to the Data in File Variables

Timestamped Variables


You can access the timestamp value by specifying the timestamp index (1-based, i.e. the first
timestamp has index 1) in square brackets:

doc = GetActiveDocument()

% first option: use doc.VarName notation

timestamp = doc.DSP01a[3]

% second option: get variable by name and then use the variable directly

spikeTrain = GetVarByName(doc, "DSP01a")

timestamp = spikeTrain[3]

% third option: get variable using doc["VarName"] notation and then use the

variable directly

spikeTrain1 = doc["DSP01a"]

timestamp = spikeTrain1[3]


You can assign a new value for any timestamp in the current file. For example, to assign the value
0.5 (sec) to the third timestamp of the variable dsp01a, you simply write:

doc = GetActiveDocument()

doc.DSP01a[3] = 0.5


You can also add timestamps to a variable using NexScript functions. See

Properties of Variables

and Adding Data to Variables

for details.

Interval Variables


IntVar[i,1] gives you read/write access to the start of the i-th interval, IntVar[i,2] gives you read/write
access to the end of the i-th interval.


For example, the following script creates a new interval variable that has two intervals: from 0 to 100
seconds and from 200 to 300 seconds:

doc = GetActiveDocument()

doc.MyInterval = NewIntEvent(doc, 2)

doc.MyInterval[1,1] = 0.

doc.MyInterval[1,2] = 100.

doc.MyInterval[2,1] = 200.

doc.MyInterval[2,2] = 300.

Page 134

Advertising