DeleteVar
Deletes the specified variable from the file.
Syntax
DeleteVar(doc, number, varType)
Parameters
Parameter |
Type |
Description |
---|---|---|
doc |
documentReference |
Reference to the document. |
number |
number |
1-based variable number within the group specified by varType |
varType |
string |
Variable type. Should be ‘neuron’, ‘neuronorevent’ , ‘event’, ‘interval’ ‘wave’, ‘popvector’, ‘continuous’, ‘marker’ or ‘all’ |
Return
None.
Note
All the analysis windows are closed before executing this function. Please note that this function produces an immediate result - after the execution of this function, the number of variables of the specified type is reduced by 1. Therefore, you cannot use a simple for loop to delete all the variables of a certain type. You can use while loop as shown in the example script below.
Examples
Python
import nex
doc = nex.GetActiveDocument()
# delete the first continuous variable
nex.DeleteVar(doc, 1, "continuous")
# delete all waveform variables
# note that we always delete the first variable
while nex.GetVarCount(doc, "wave") > 0:
nex.DeleteVar(doc, 1, "wave")
NexScript
doc = GetActiveDocument()
% delete the first continuous variable
DeleteVar(doc, 1, "continuous")
% delete all waveform variables
% note that we always delete the first variable
while GetVarCount(doc, "wave") > 0
DeleteVar(doc, 1, "wave")
end