Script variables – Multichannel Systems NeuroExplorer User Manual

Page 135

Advertising
background image

5.1. Script Variables

Variable Names


The variable name in NexScript should begin with a letter and contain only letters, digits and the
underscore sign.


The following names are valid:


Neuron01 Bar_press Nr_1a DSP02b


These variable names cannot be used in NexScript:

2Neuron Bar-press


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 file variable is by getting a reference to the variable:

DSP01a = GetVarByName(doc, "DSP01a")


See Also

File Variables

Variable Types


NexScript supports numeric variables:

xmean = (xmax - xmin)/2.


and strings:

name = "DSP" + "01"


A variable can also be a reference to the existing variable in the file:

neuron1 = GetVar(doc, 1, "neuron")


or a reference to the opened document:

doc = GetActiveDocument()


A variable type can be changed if the right-hand side of the assignment has a different type. For
example:

x = 0.005 % x now is a numeric variable

x = "DSP" % after this statement, x is a string

Global Variables


A variable can be declared global so that it can be accessed from several scripts:

Global name


Global statements should be placed at the beginning of the script.


See Also

File Variables

Page 133

Advertising