NeuroExplorer Manual Copyright © 1998-2011 Nex Technologies
Revision: 4.095. Date: 9/23/2011.
Table of Contents 1. Getting Started 7 1.1. Getting Started with NeuroExplorer 8 1.2. Working with Sentinel Keys 9 1.3. NeuroExplorer Screen Elements 12 1.4. Opening Files and Importing Data 16 1.5. Importing Files Created by Data Acquisition Systems 17 1.6. Importing Data from Text Files 19 1.7. Importing Data from Spreadsheets 20 1.8. Importing Data from Matlab 22 1.9. Reading and Writing NeuroExplorer Data Files 23 1.10. 1D Data Viewer 24 1.11. Analyzing Data 25 1.12.
2.21. Synchrony vs. Time 81 2.22. Trial Bin Counts 83 2.23. Power Spectral Densities 85 2.24. Burst Analysis 88 2.25. Principal Component Analysis 91 2.26. PSTH Versus Time 93 2.27. Correlations with Continuous Variable 95 2.28. Regularity Analysis 97 2.29. Place Cell Analysis 99 2.30. Reverse Correlation 103 2.31. Epoch Counts 106 2.32. Coherence Analysis 108 2.33. Spectrogram Analysis 111 2.34. Perievent Spectrograms 113 2.35. Joint ISI Distribution 115 2.36. Autocorrelograms Versus Time 117 3.
.5.2.1. GetDocPath Function 160 5.5.2.2. GetDocTitle Function 161 5.5.2.3. GetTimestampFrequency Function 162 5.5.2.4. GetDocEndTime Function 163 5.5.2.5. SetDocEndTime Function 164 5.5.2.6. GetDocComment Function 165 5.5.3. Document Variables Functions 166 5.5.3.1. GetVarCount Function 167 5.5.3.2. GetVarName Function 168 5.5.3.3. GetVarSpikeCount Function 169 5.5.3.4. GetVar Function 170 5.5.3.5. DeleteVar Function 171 5.5.3.6. Delete Function 172 5.5.3.7. GetVarByName Function 173 5.5.3.8.
5.5.7.7. GetNumResSummaryNRows Function 221 5.5.7.8. GetNumResSummaryColumnName Function 222 5.5.7.9. GetNumResSummaryData Function 223 5.5.7.10. SendResultsSummaryToExcel Function 224 5.5.7.11. SaveNumResults Function 225 5.5.7.12. SaveNumSummary Function 226 5.5.8. Operations on Variables Functions 227 5.5.8.1. Rename Function 229 5.5.8.2. Join Function 230 5.5.8.3. Sync Function 231 5.5.8.4. NotSync Function 232 5.5.8.5. FirstAfter Function 233 5.5.8.6. FirstNAfter Function 234 5.5.8.7.
5.5.13.4. ceil Function 282 5.5.13.5. round Function 283 5.5.13.6. abs Function 284 5.5.13.7. sqrt Function 285 5.5.13.8. pow Function 286 5.5.13.9. exp Function 287 5.5.13.10. min Function 288 5.5.13.11. max Function 289 5.5.13.12. log Function 290 5.5.13.13. sin Function 291 5.5.13.14. cos Function 292 5.5.13.15. tan Function 293 5.5.13.16. acos Function 294 5.5.13.17. asin Function 295 5.5.13.18. atan Function 296 5.5.13.19. RoundToTS Function 297 5.5.13.20. GetFirstGE Function 298 5.5.13.21.
6.2.9. EventCount Property 340 6.2.10. IntervalCount Property 341 6.2.11. MarkerCount Property 342 6.2.12. WaveCount Property 343 6.2.13. ContinuousCount Property 344 6.2.14. Variable Method 345 6.2.15. Neuron Method 346 6.2.16. Event Method 347 6.2.17. Interval Method 348 6.2.18. Marker Method 349 6.2.19. Wave Method 350 6.2.20. Continuous Method 351 6.2.21. DeselectAll Method 352 6.2.22. SelectAllNeurons Method 353 6.2.23. SelectAllContinuous Method 354 6.2.24. ApplyTemplate Method 355 6.2.25.
1. Getting Started Installation Before you can use NeuroExplorer, you must install NeuroExplorer program files, Sentinel system drivers and install the Sentinel hardware key. Running NeuroExplorer Setup Before you begin installing NeuroExplorer and its components, please exit all currently running applications. Please follow the following steps to install NeuroExplorer: • • • • • • Insert NeuroExplorer Setup USB flash drive into your computer USB port Navigate to NeuroExplorer4Setup.
1.1.
1.2. Working with Sentinel Keys General NeuroExplorer requires a Sentinel key to operate. Sentinel drivers need to be installed so that NeuroExplorer can communicate with the Sentinel keys. These drivers are installed when you run NeuroExplorer setup (NeuroExplorer4Setup.exe). Running NeuroExplorer via Remote Desktop If you would like to run NeuroExplorer via remote desktop, you will need to use Sentinel Protection Server on the server (the computer that runs NeuroExplorer).
remove this version and reboot the computer. - To install the 7.4.0 drivers, run the driver installer: C:\Program Files\Nex Technologies\NeuroExplorer\SentinelD rivers\SentinelSetup.7.4.0.exe - Reboot the computer after installing the drivers. 3) If the problem persists, you may need to use the Cleanup utility. - Uninstall NeuroExplorer and all the Sentinel software items listed in Control Panel | Add or Remove Programs - Download Sentinel cleanup utility (SSD Cleanup) from this page: http://www.safenetinc.
of the NeuroExplorer resellers listed in the Purchase page of the NeuroExplorer web site: http://www.neuroexplorer.com/purchas e.
1.3. NeuroExplorer Screen Elements NeuroExplorer user interface consists of the main window surrounded by several panels. These panels allow you to select files, select analyses and specify analysis properties. The figure below shows the default layout of NeuroExplorer window. Files, Properties, Analyses, Variables and Explore panels are visible and Templates and Scripts panels are hidden. To view a hidden panel, click at the panel tab or use View menu command.
data file, simply double-click the file name. Analyses Panel This view allows you to quickly select one of the analyses available in NeuroExplorer. To apply analysis to the active data file, click at the analysis name. Properties Panel The left column of the Properties Panel lists the names of adjustable parameters for the selected object. The right column contains various controls that can be used to change the parameter values. To apply the changes, press the Apply button or hit the F5 key.
Variables Panel You can analyze all the variables in your data file, a subset of the variables, or may be just one variable. Variables Panel allows you to quickly select and deselect the variables used for analysis: The left column shows the variables that are not currently selected; the right column shows the selected variables. To move variables from column to column, first select them, then press ">" (Select) or "<" (Deselect) buttons.
Explore panel allows you to quickly explore analysis parameter ranges. Select a parameter you want to explore from a list and drag a slider. NeuroExplorer will keep recalculating analysis with the new parameter values while you drag the slider, thus creating an “analysis animation”.
1.4. Opening Files and Importing Data NeuroExplorer can read native data files created by popular data acquisition systems (Alpha Omega, CED Spike-2, Cortex, Blackrock Microsystems, DataWave, Multi Channel Systems, Neuralynx, Plexon, RC Electronics. See Importing Files Created By Data Acquisition Systems for more information). NeuroExplorer can also import data from text files (see Importing Data from Text Files ).
1.5. Importing Files Created by Data Acquisition Systems NeuroExplorer can read native data files created by popular data acquisition systems (Alpha Omega, CED Spike-2, Cortex, DataWave, Blackrock Microsystems, Multi Channel Systems, Neuralynx, Plexon, RC Electronics). Since NeuroExplorer does not provide spike sorting capabilities yet, it is assumed that you have already sorted (clustered) the waveforms. Alpha Omega Files NeuroExplorer can import Alpha Omega MAP, ISI, NDA, MAT and LSM files.
Multi Channel Systems Files NeuroExplorer can import standard MCS data files. All the sorted spike trains and external events are imported. The waveforms are not imported. Analog channels can be imported as an option (see File Import Options below). Neuralynx Files NeuroExplorer can import Neuralynx data files (tt*.dat, se*.dat, etc.) as well as the files created by MClust spike sorter (*.t files). All the sorted spike trains are imported. External events are imported as markers.
1.6. Importing Data from Text Files You can specify text import options in the Text Import dialog: Sampling Frequency - this parameter defines the internal representation of the timestamps that NeuroExplorer will use for this file. Internally, the timestamps are stored as integers representing the number of time ticks from the start of the experiment. The time tick is equal to 1.
name, NeuroExplorer will add "event" at the beginning of the name. is a number representing the neuron firing time (or event time) in seconds or in time ticks. Here is an example of a text file with the timestamps represented in seconds: Neuron01 Neuron01 Neuron02 Neuron02 Neuron01 Neuron02 Neuron02 0.01 0.3 0.001 0.05 0.5 0.1 0.4 3.
Timestamped data can be pasted directly into the NeuroExplorer data table.
1.8. Importing Data from Matlab You can create spike trains (1xN or Nx1 matrices with timestamps in seconds) or continuous variables in Matlab and transfer them to NeuroExplorer on the fly. Here is how to do this: • • • • • • • Select File | New menu command. Select Matlab | Get Data From Matlab... | Open Matlab As Engine menu command. NeuroExplorer will open Matlab as engine. In opened Matlab, run your Matlab scripts and create (or load from file) spike train variables or continuous variables.
1.9. Reading and Writing NeuroExplorer Data Files NeuroExplorer Data file has the following structure: file header variable header 1 variable header 2 ... data for variable i data for variable j ... Each variable header contains the size of the array that stores the variable data as well as the location of this array in the file.
1.10. 1D Data Viewer NeuroExplorer provides a window that displays graphically all the selected variables. To open this window, use View | 1D Data Viewer Window menu command. You can also use 1D view to manually add events to the data file. Simply press the left mouse button when the pointer is in the 1D view and NeuroExplorer will add a new timestamp to the variable ManualEvent.
1.11. Analyzing Data NeuroExplorer provides a variety of spike train analysis methods. Each method has a number of parameters and options. You can apply any available analysis by clicking at the corresponding analysis in the Analyses Panel (you can also use Analysis | Select Analysis menu commands): After you click at one of the analysis items, NeuroExplorer will open a dialog that will allow you to edit the analysis parameters.
1.12. Selecting Variables for Analysis NeuroExplorer can analyze at once any group of variables in the file. To select the variables to be analyzed, use one of the following methods: • • • Select the variables using the Variable Panel (see How to select variables using Variables Panel ) Select the variables using Analysis | Select Variables menu command. This command will invoke the Variable Selection dialog similar to Variables Panel.
1.13. How to Select Variables for Existing Window Variables selected in the Variables spreadsheet of data window are used to populate variables lists of new analysis windows.
• • Make changes in selected variables list ( how to make changes? ) and press Apply button If Variables panel or its tab is not visible, use View | Variables Panel menu command Page 28
1.14. How to Select Variables in Variables Panel Select variables for analysis by moving them from the left (available) to the right (selected) list box. In the figure below, 6 variables (Neuron04a, Neuron05b, ...
1.15. Adjusting Analysis Properties There are several methods to adjust the analysis parameters: • • Use Analysis | Edit Parameters menu command to invoke the Analysis Parameters dialog Right-click in the Graph Window and choose Analysis Parameters item in the floating menu The floating menu is the fastest way to adjust any analysis or graphics parameters.
1.16. Analysis Templates In any analysis in NeuroExplorer, you can adjust a large number of parameters: • • • • • Analysis type (Rate Histograms, IIH, etc) Analysis parameters (Bin, XMin, XMax, etc.) Graph parameters (graph type, graph color, grid lines, etc) Parameters of X and Y axes (labels, numerics, lines, colors, etc.
1.17. Numerical Results To view the analysis numerical results, select View | Numerical Results menu command. You can also press the "View. Num. Res." button in the upper-left corner of the Properties Panel: NeuroExplorer will open Numerical Results Window: Note that the window has two Excel-style sheets -- the Results sheet and the Summary sheet. The Results sheet usually contains the bin counts or other histogram values.
1.18. Post-processing For the histogram-style analyses, NeuroExplorer has an optional Post-Processing analysis step. You can select post-processing options using Post-processing tab in the Analysis Parameters dialog (double-click in Graph window and select Analysis Parameters menu item): You can smooth the resulting histogram with Gaussian or Boxcar filters. You can also add bin information to the matrix of results. See Post-processing Options for details.
Power point presentation then becomes your lab notebook where you can save your NeuroExplorer analysis results: Page 34
1.20. Working with Matlab NeuroExplorer can interact with Matlab via COM interface using Matlab as a powerful postprocessing engine. Matlab can also control NeuroExplorer and exchange data with NeuroExplorer via NeuroExplorer COM interfaces. See COM/ActiveX Interfaces for details. Immediately after calculating the histograms, NeuroExplorer can send the resulting matrix of histograms to Matlab and then ask Matlab to execute any series of Matlab commands.
ts = [ts; (fragmentTs(i) + (0:(valuesInFragment-1))*step)']; end end You can also import timestamped and continuous variables directly from Matlab. See Importing Data From Matlab for details. See Also Importing Data From Matlab COM/ActiveX Interfaces 1.21.
1.22. Saving Graphics NeuroExplorer can save the contents of the Graph window in a file using the Windows Metafile format. The file can then be opened in any program that can use the.wmf format files (a word processor, graphics editor, etc.). To save the graphics in a metafile, use File | Save Graphics menu command. You can also copy the graphics to the clipboard and then paste in another application. To copy the graphics, single-click in the graph area and then select Edit | Copy menu command.
2. Analysis Reference This section, NeuroExplorer Analysis Reference, describes general pre-processing and postprocessing analysis options, analysis parameters and computational algorithms used in analyses.
2.1. Data Types NeuroExplorer supports several data types -- spike trains, behavioral events, time intervals, continuously recorded data and other data types. The topics in this section describe the data types used in NeuroExplorer, list the properties of data types, and show how to view and modify various data types in NeuroExplorer. 2.1.1. Spike Trains In NeuroExplorer, the most commonly used data type is a spike train.
Numerical values of the timestamps (in seconds) are shown in the Timestamps sheet of the Data view: 2.1.2. Events Event data type in NeuroExplorer is used to represent the series of timestamps recorded from external devices (for example, stimulation times recorded as pulses produced by the stimulus generator). Event data type stores only the times when the external events occurred. A special Marker data type is used to store the timestamps together with other stimulus or trial information.
Creating Interval Variables You can create intervals in NeuroExplorer using Edit | Add Interval Variable menu command. You can also create intervals based on existing Event or Interval variables. Use Edit | Operations on Data Variables menu command and then select one of the following operations: MakeIntervals MakeIntFromStart MakeIntFromEnd IntOpposite IntAnd IntOr IntSize IntFind Burst analysis creates interval variables (one for each neuron) that contain all the detected bursts as time intervals.
2.1.4. Markers Marker data type in NeuroExplorer is used to represent the series of timestamps recorded from external devices (for example, stimulation times recorded as pulses produced by the stimulus generator) together with other stimulus or trial information. Event data type stores only the times when the external events occurred.
2.1.5. Population Vectors Population vectors in NeuroExplorer can be used to display the linear combinations of histograms in some of the analyses. For example, you can calculate perievent histograms for each individual neuron recorded in a data file. If you want to calculate the response of the whole population of neurons (that is, create an average PST histogram) you need to use a population vector. Population vector assigns a weight to each spike train or event variable in the file.
Principal Component Analysis creates a set of population vectors based on correlations between activities of individual neurons. 2.1.6. Waveforms The waveform data type is used in NeuroExplorer to store the spike waveform values together with the spike timestamps. The following figure shows the waveform variable sig006a_wf together with the corresponding spike train sig006a: The waveform data may not be imported by default from the data files created by the data acquisition systems.
2.1.7. Continuously Recorded Data The continuous data type is used in NeuroExplorer to store the data that has been continuously recorded (digitized). The following figure shows continuous variable AD01 together with the spike train sig001a: Continuous data may not be imported by default from the data files created by the data acquisition systems. Use View | Data Import Options menu command to specify which data types NeuroExplorer will import from the data files.
2.2. Data Selection Options Before performing the analysis, NeuroExplorer can select the timestamped events that are inside the specified time intervals: For example, you may want to analyze only the first 10 minutes of the recording session.
2.3. Post-Processing Options For the histogram-style analyses, NeuroExplorer has an optional Post-processing analysis step. You can select post-processing options using Post-processing tab in the Analysis Parameters dialog. (double-click in the Graph window and select Analysis Parameters menu item): You can smooth the resulting histogram with Gaussian or Boxcar filters. The boxcar filter is a filter with equal coefficients.
2.4. Matlab Options NeuroExplorer can interact with Matlab via COM interface using Matlab as a powerful postprocessing engine. Immediately after calculating histograms, NeuroExplorer can send the resulting matrix of histograms to Matlab and then ask Matlab to execute any series of Matlab commands. Use the Matlab tab in the Analysis parameters dialog to specify the matrix name and the Matlab command string. 2.5. Excel Options NeuroExplorer can send numerical results directly to Excel.
2.6. Confidence Limits for Perievent Histograms If the total time interval (experimental session) is T (seconds) and we have N spikes in the interval, then the neuron frequency is: F = N/T Several options how to calculate neuron frequency F are available. See Options below.
2.7. Cumulative Sum Graphs Here is the algorithm that is used to draw optional cumulative sum graphs above the histograms. Suppose we have a histogram with bin counts bc[i], i=1,...,N. Cumulative Sum Graph displays the following values cs[i]: for bin 1: cs[1] = bc[1] - A for bin 2: cs[2] = bc[1]+bc[2] - A*2 for bin 3: cs[3] = bc[1]+bc[2]+bc[3] - A*3, etc.
2.8. Rate Histograms Rate histogram displays firing rate versus time. Parameters Parameter Description XMin/XMax type An option on how XMin and XMax values are specified. XMin Time axis minimum in seconds. XMax Time axis maximum in seconds Bin Histogram bin size in seconds. Normalization Histogram units (Counts/Bin, Probability or Spikes/Second). See Algorithm below.
Variable Variable name. YMin Histogram minimum. YMax Histogram maximum. Spikes The number of spikes used in calculation. Filter Length The length of all the intervals of the interval filter (if a filter was used) or the length or the recording session (in seconds). Mean Freq. Mean firing rate (Spikes/Filter_Length). Mean Hist. The mean of the histogram bin values. St. Dev. Hist. The standard deviation of the histogram bin values. St. Err. Mean. Hist.
2.9. Interspike Interval Histograms Interspike interval histogram shows the conditional probability of a first spike at time t0+t after a spike at time t0. Parameters Parameter Description Min Interval Minimum interspike interval in seconds. Max Interval Maximum interspike interval in seconds. Bin Bin size in seconds. Normalization Histogram units (Counts/Bin, Probability or Spikes/Second). See Algorithm below.
Add to Results / Bin middle An option to add an additional vector (containing a middle point of each bin) to the matrix of numerical results. Add to Results / Bin right An option to add an additional vector (containing a right edge of each bin) to the matrix of numerical results. Send to Matlab An option to send the matrix of numerical results to Matlab. See also Matlab Options. Matrix Name Specifies the name of the results matrix in Matlab workspace.
For example, for the first bin bin_count = number of interspike intervals (isi) such that isi >= IntMin and isi < IntMin + Bin If Normalization is Counts/Bin, no further calculations are performed. If Normalization is Probability, bin counts are divided by the number of interspike intervals in the spike train. If Normalization is Spikes/Sec, bin counts are divided by NumInt*Bin, where NumInt is the number of interspike intervals in the spike train.
2.10. Autocorrelograms Autocorrelogram shows the conditional probability of a spike at time t0+t on the condition that there is a spike at time t0. Parameters Parameter Description XMin Time axis minimum in seconds. XMax Time axis maximum in seconds. Bin Bin size in seconds. Normalization Histogram units (Counts/Bin, Probability or Spikes/Second). See Algorithm below.
colored background. Conf. line style Line style for drawing confidence limits (used when Conf. display is Lines ). Conf. background color Background color for drawing confidence limits (used when Conf. display is Colored Background ). Draw mean freq. An option to draw a horizontal line representing the expected histogram value for a Poisson spike train. See Confidence Limits for details. Mean line style Line style for drawing mean frequency.
Norm. Factor Normalization factor. Bin counts are divided by this value. See Normalization in Algorithm below. First Min. Time Position of the histogram minimum (in seconds). If there are multiple bins in the histogram where the bin value equals to the histogram minimum, this value represents the position of the first such bin. First Max. Time Position of the histogram maximum (in seconds).
2.11. Perievent Histograms Perievent Histogram shows the conditional probability of a spike at time t0+t on the condition that there is a reference event at time t0. Parameters Parameter Description Reference Type Specifies if the analysis will use a single or multiple reference events. Reference Specifies a reference neuron or event (or a group of reference neurons or events). XMin Histogram time axis minimum in seconds. XMax Histogram time axis maximum in seconds Bin Bin size in seconds.
Draw confidence limits An option to draw the confidence limits. Confidence (%) Confidence level (percent). See Confidence Limits for details. Conf. mean calculation An option that specifies how the mean firing rate (that is used in the derivation of the confidence limits) is calculated. There are 3 options: Use data selection, Use all file and Use pre-ref data. See Confidence Limits for details. Note that Use pre-ref data option can only be used for a stimulation type data, i.e.
Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. Reference Reference variable name. NumRefEvents The number of reference events used in calculation. YMin Histogram minimum. YMax Histogram maximum. Spikes The number of spikes used in calculation. Filter Length The length of all the intervals of the interval filter (if a filter was used) or the length or the recording session (in seconds).
Trough Z-score Trough Z-score. See Peak and Trough Statistics below. Trough/Mean Histogram trough value divided by the background mean value. Trough Position Trough position (in seconds). Trough Half Height The Y value of the half height of the trough, i.e. histogram_background_mean + (trough-mean)/2. Trough Width at Half Height Trough width at the trough half height level (in seconds).
NeuroExplorer calculates the histogram peak statistics the following way: • • • • • • • • • Maximum of the histogram is found If the histogram contains several maxima with the same value, peak statistics are not calculated Otherwise, the center of the bin, where the histogram reaches maximum, is shown as Peak Position in the Summary of Numerical results The mean M and standard deviation S of the bin values of the histogram background are calculated: If Background parameter is set as Bins outside peak/tro
2.12. Crosscorrelograms Crosscorrelogram shows the conditional probability of a spike at time t0+t on the condition that there is a reference event at time t0. Compared to PSTH (that calculates the same probabilities), crosscorrelogram allows to use shiftpredictors. Parameters Parameter Description Reference Type Specifies if the analysis will use a single or multiple reference events. Reference Specifies a reference neuron or event (or a group of reference neurons or events).
Smooth Option to smooth the histogram after the calculation. See Post-Processing Options for details. Smooth Filter Width The width of the smooth filter. See Post-Processing Options for details. Shift-predictor An option to use shift-predictor. Shift-predictor requires that an interval filter is used in the analysis. See Using Shift-Predictor for details. Shift times How many times to calculate shift predictor. See Using Shift-Predictor for details.
Send to Matlab An option to send the matrix of numerical results to Matlab. See also Matlab Options. Matrix Name Specifies the name of the results matrix in Matlab workspace. Matlab command Specifies a Matlab command that is executed after the numerical results are sent to Matlab. Send to Excel An option to send numerical results or summary of numerical results to Excel. See also Excel Options. Sheet Name The name of the worksheet in Excel where to copy the numerical results.
Background Mean The mean of the histogram background for the peak and trough analysis. See Peak and Through Statistics below. Background Stdev The standard deviation of the histogram background for the peak and trough analysis. See Peak and Trough Statistics below. Peak Z-score Peak Z-score. See Peak and Trough Statistics below. Peak/Mean Histogram peak value divided by the background mean value. Peak Position Peak position (in seconds).
exceed the number of reference events. Then, the probability value (bincount[1]/number_of_reference_events) could be larger than 1. If Normalization is Spikes/Sec, bin counts are divided by NumRefEvents*Bin, where NumRefEvents is the number of reference events. If Normalization is Z-score, bin_value = (bin_count - Confidence_mean)/sqrt(Confidence_mean), where Confidence_mean is the expected mean bin count calculated according to Conf. mean calculation parameter.
2.13. Shift-Predictor for Crosscorrelograms Shift-predictor is defined for a series of trials - you take the spikes of one neuron in trial 1 and correlate them with the spikes of another neuron in trial 2, etc. These "trials" are represented in NeuroExplorer as time intervals, i.e. pairs of numbers: start of interval 1, end of interval 1 start of interval 2, end of interval 2, etc. To use the shift-predictor, you need to create those "trials" first.
Then, calculate shift-predictors for shift = 2: Repeat Steps 1 through 4 with interval [t1a, t1b] in Step 1 and interval [t3a, t3b] in Step 2. That is, shift trials by 2. ... And, finally, calculate shift-predictors for shift = Number_of_shifts specified in the shift-predictor options. More on Time Intervals These time intervals can be used in other analyses in NeuroExplorer to analyze spikes only from those intervals.
2.14. Rasters The raster display shows the spikes as vertical lines (tick) positioned according to the spikes timestamps. This analysis does not generate numerical results since the raster lines (ticks) are drawn directly from the data. Some generic analysis statistics are available in the Summary of Numerical Results (see below). Parameters Parameter Description XMin Time axis minimum in seconds.
2.15. Perievent Rasters This analysis shows the timestamps of the selected variable relative to the timestamps of the reference variable. Parameters Parameter Description Reference Type Specifies if the analysis will use a single or multiple reference events. Reference Specifies a reference neuron or event (or a group of reference neurons or events). XMin Time axis minimum in seconds.
Create filter on-the-fly Specifies if a temporary interval filter needs to be created (and used to preselect data). Create filter around Specifies an event that will be used to create a temporary filter. Start offset Offset (in seconds, relative to the event specified in Create filter around parameter) for the start of interval for the temporary filter. End offset Offset (in seconds, relative to the event specified in Create filter around parameter) for the end of interval for the temporary filter.
Continuous variables can also be used in this analysis. For each ref[k], NeuroExplorer calculates a series of bins. The first bin is: [ref[k]+XMin, ref[k]+XMin+Bin] the second bin is [ref[k]+XMin+Bin, ref[k]+XMin+Bin+Bin], etc. Then, the average value of a continuous variable is calculated within each of the bins and this average value is displayed using the color scale. If bin does not contain any timestamps of the continuous variable, the previous value of the continuous variable is used.
2.16. Joint PSTH Joint PSTH matrix shows the correlations of the two neurons around the reference events. Parameters Parameter Description XMin Time axis minimum in seconds. XMax Time axis maximum in seconds Bin Bin size in seconds. Reference Specifies a reference neuron or event. Bottom Neuron The neuron of event shown along the horizontal axis (the vertical axis shows a neuron selected for analysis).
Excel. See also Excel Options. Sheet Name The name of the worksheet in Excel where to copy the numerical results. TopLeft Specifies the Excel cell where the results are copied. Should be in the form CR where C is Excel column name, R is the row number. For example, A1 is the top-left cell in the worksheet. Matrix Scale An option on how to draw the scatter matrix (color or black and white). Font size (% matrix) Font size in percent of scatter matrix height.
2.17. Cumulative Activity Graphs The cumulative activity display shows a stepwise function which makes a jump at the moment of spike and stays constant between the spikes. This analysis does not generate numerical results since the stepwise function is drawn directly from the data. Some generic analysis statistics are available in the Summary of Numerical Results (see below). Parameters Parameter Description XMin Time axis minimum in seconds.
2.18. Instant Frequency The instant frequency display shows the instantaneous frequency of the spike train (at the end of each interspike interval, the inverted interspike interval is drawn as a vertical line). This analysis does not generate numerical results since the graph is drawn directly from the data. Some generic analysis statistics are available in the Summary of Numerical Results (see below). Parameters Parameter Description XMin Time axis minimum in seconds.
2.19. Interspike Intervals vs. Time The intervals vs. time graph displays interspike intervals against time (at the end of each interspike interval, the point is drawn with the Y coordinate equal to the interspike interval). This analysis does not generate numerical results since the graph is drawn directly from the data. Some generic analysis statistics are available in the Summary of Numerical Results (see below). Parameters Parameter Description XMin Time axis minimum in seconds.
2.20. Poincare Maps For each spike, a point is displayed where the X coordinate of the point is the current interspike interval and Y coordinate of the point is the preceding interspike interval. This analysis does not generate numerical results since the graph is drawn directly from the data. Some generic analysis statistics are available in the Summary of Numerical Results (see below). Parameters Parameter Description Min Interval Time axis minimum in seconds.
2.21. Synchrony vs. Time For each spike, this graph shows the distance from this spike to the closest spike (timestamp) in the reference event. This analysis does not generate numerical results since the graph is drawn directly from the data. Some generic analysis statistics are available in the Summary of Numerical Results (see below). This analysis is useful in identifying the moments in time when several neurons are in sync with the reference neuron. To do this, you need to select Inverted Distance.
YMin Y axis minimum. YMax Y axis maximum. Spikes The number of spikes used in calculation. Mean Freq. Mean firing rate. Algorithm For each spike that occurred at time t[i], this graph shows the distance from this spike to the closest spike (timestamp) in the reference event: dist = min(abs(t[i] - ref[j])), where ref[j] is a timestamp of the reference event If Distance is Linear, the vertical line is drawn from point ( t[i], 0.) to point (t[i], dist).
2.22. Trial Bin Counts Trial bin counts analysis computationally is essentially the same as the perievent histogram. The difference is that the bin counts are saved for each reference event. Parameters Parameter Description Reference Specifies a reference neuron or event. XMin Histogram time axis minimum in seconds. XMax Histogram time axis maximum in seconds Bin Bin size in seconds. Normalization Histogram units (Counts/Bin, Probability or Spikes/Second). See Algorithm below.
Color Scale Min Color scale minimum. Color Scale Max Color scale maximum. Reference Reverence event. NumRefEvents Number of reference events. Bin001Mean Mean of all the values for Bin 1. Bin001SdDev Standard deviation of all the values for Bin 1. Algorithm Trial bin counts analysis computationally is essentially the same as the perievent histogram. The difference is that the bin counts are saved for each reference event. The time axis is divided into bins. The first bin is [XMin, XMin+Bin).
2.23. Power Spectral Densities This analysis captures the frequency content of continuous variables or neuronal rate histograms. Parameters Parameter Description Max Frequency Maximum frequency of the spectrum in Hz Number of values Number of values in the spectrum. Show Frequency From Minimum frequency to be shown in the spectrum graph. Show Frequency To Maximum frequency to be shown in the spectrum graph. Normalization Spectrum normalization. See Algorithm below.
right to the matrix of numerical results. Send to Matlab An option to send the matrix of numerical results to Matlab. See also Matlab Options. Matrix Name Specifies the name of the results matrix in Matlab workspace. Matlab command Specifies a Matlab command that is executed after the numerical results are sent to Matlab. Send to Excel An option to send numerical results or summary of numerical results to Excel. See also Excel Options.
intervals. For each interval: • • • The rate histogram is calculated. The histogram is detrended (its linear regression is subtracted) The Hann window w[i] = (1 - cos(2*PI*i/(NumBer_Of_Bins-1)))/2 is applied to the histogram. • • FFT of the result is calculated. Raw power spectrum is formed from the FFT. Spectral Densities for Continuous Variables If Maximum_Frequency = M and Number_of_Frequency_Values = N, we need to calculate the spectrum for frequency values 0, M/N, 2*M/N, ..., M.
2.24. Burst Analysis This analysis identifies bursts in spike trains. For each spike train (neuron variable), a new interval variable is created that contains the time intervals corresponding to bursts. Parameters Parameter Description Algorithm Selection of MaxInterval or Surprise algorithms. Max Interval Maximum interspike interval to start the burst (in seconds, MaxInterval method). Max End Interval Maximum interspike interval to end the burst (in seconds, MaxInterval method).
Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. YMin Burst rate histogram minimum. YMax Burst rate histogram maximum. Spikes The number of spikes used in spectrum calculation. Filter Length The length of all the intervals of the interval filter (if a filter was used) or the length or the recording session (in seconds). Mean Frequency Mean firing rate (Spikes/Filter_Length).
Algorithm For each spike train, NeuroExplorer creates a new Interval variable and stores all the burst intervals in this variable. MaxInterval method Find all the bursts using the following algorithm: • • • • • Scan the spike train until an interspike interval is found that is less than or equal to Max. Interval . While the interspike intervals are less than Max. End Interval, they are included in the burst. If the interspike interval is more than Max. End Interval, the burst ends.
2.25. Principal Component Analysis This analysis calculates eigenvalues and eigenvectors (principal components) of the matrix of correlations of rate histograms. The analysis creates population vectors corresponding to the principal components. Parameters Parameter Description Bin Bin size in seconds. Vectors Prefix A string specifying how the population vector names will be generated. For example, if prefix is pca1, the vector names will be pca1_01, pca1_02, etc.
The Results sheet shows for each neuron the weights this neuron has in all the eigenvectors. Algorithm Step 1. Rate histograms are calculated for each of the selected neurons. The time axis is divided into bins. The first bin is [0, Bin). The second bin is [Bin, Bin*2), etc. The left end is included in each bin, the right end is excluded from the bin. For each bin, the number of events (spikes) in this bin is calculated.
2.26. PSTH Versus Time This analysis shows the dynamics of the perievent histogram over time. It calculates multiple PST histograms using a "sliding window" in time. Each histogram is shown as a vertical stripe with colors representing the bin counts. Horizontal axis represents the position of the sliding window in time. Parameters Parameter Description Reference Specifies a reference neuron or event. XMinPSTH Histogram time minimum in seconds.
TopLeft Specifies the Excel cell where the results are copied. Should be in the form CR where C is Excel column name, R is the row number. For example, A1 is the top-left cell in the worksheet. Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. Reference Reference variable name. YMin PSTH minimum. YMax PSTH maximum. Color Scale Min PSTH minimum. Color Scale Max PSTH maximum.
2.27. Correlations with Continuous Variable This analysis calculates crosscorrelations between a continuously recorded variable and a neuronal firing rate, or crosscorrelations between a continuously recorded variable and another continuous variable. Parameters Parameter Description Reference Specifies a reference continuous variable. XMin Time axis minimum in seconds. XMax Time axis maximum in seconds. Bin Type An option to specify how the bin value is determined.
Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. Reference Reference variable name. YMin Y axis minimum. YMax Y axis maximum. Mean Hist. Mean of all the correlation values for this variable. St. Dev. Hist Standard deviation of all the correlation values for this variable. St. Eff. Mean Hist Standard error of mean of all the correlation values for this variable.
2.28. Regularity Analysis This analysis estimates the regularity of neuronal firing after the stimulation. Parameters Parameter Description Reference Specifies a reference event or spike train. XMin Time axis minimum in seconds. XMax Time axis maximum in seconds. Bin Bin size in seconds. Used if Bin Type is set to User defined. Select Data If Select Data is From Time Range, only the data from the specified (by Select Data From and Select Data To parameters) time range will be used in analysis.
Filter Length The length of all the intervals of the interval filter (if a filter was used) or the length or the recording session (in seconds). Mean Freq. Mean firing rate (Spikes/Filter_Length). Mean Hist. The mean of the histogram bin values (ISI values). St. Dev. Hist. The standard deviation of the histogram bin values. St. Dev. ISI The mean value of the SD ISI graph. CV The mean value of the CV ISI graph.
2.29. Place Cell Analysis This analysis estimates the frequency of neuronal firing as a function of position of an animal. The animal position should be described by two continuously recorded variables. Parameters Parameter Description X Position Continuous variable that describes X position of the animal. Y Position Continuous variable that describes Y position of the animal.
Select Data To End of the time range in seconds. Int. filter type Specifies if the analysis will use a single or multiple interval filters. Interval filter Specifies the interval filter(s) that will be used to preselect data before analysis. See also Data Selection Options. Create filter on-the-fly Specifies if a temporary interval filter needs to be created (and used to preselect data). Create filter around Specifies an event that will be used to create a temporary filter.
Position ISI mode Average interval between two consecutive position data points (in seconds). Mean Firing Rate Mean firing rate (mean of all the firing rates for all the cells). St. Dev. Firing Rate Standard deviation of the firing rate (st. dev. of all the firing rates for all the cells). Firing Fields The number of firing fields. Field N Num Cells The number of cells in the firing field N. Field N Centroid X X coordinate of the field N centroid.
With Firing Rates display, if the animal spent less time in the cell than Min Time Spent or visited the cell less than Min Visits number of times, the firing rate for the cell is set to zero. Otherwise the number of times the neuron fired in this cell is divided by the time the animal spent in the cell producing the firing rate for the cell. Firing Field a set of at least Min.
2.30. Reverse Correlation This analysis is used for estimation of receptive fields in vision research. The analysis calculates the average visual stimulus that preceded the spike. Parameters Parameter Description Reference the variable that contains timestamps of the stimuli. Stim. Sequence File The path of the text file that contains the sequence of images used for stimulation. See Algorithm below for file format description. Char. per pixel The number of characters per pixel in image file.
Sheet Name The name of the worksheet in Excel where to copy the numerical results. TopLeft Specifies the Excel cell where the results are copied. Should be in the form CR where C is Excel column name, R is the row number. For example, A1 is the top-left cell in the worksheet. Save 3D Matrix An option to save 3D matrix of numerical results in a .csv file. 3D matrix (in X vs. Y display case) is saved starting from the first slice (at Time Min), then the second slice, etc.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The computational algorithm works the following way. For each spike of a selected neuron, NeuroExplorer identifies the images that precede the spike and are within the specified time interval (between Tmin and Tmax; for example, if Tmin = -0.
2.31. Epoch Counts This analysis is very similar to Perievent Histograms. The only distinction is that, instead of calculating bin counts for consecutive bins of the same size, Epoch Counts analysis can calculate bin counts for bins (epochs) of any size. Epochs can be of different lengths and can overlap. Parameters Parameter Description Reference Type Specifies if the analysis will use a single or multiple reference events.
Variable Variable name. Reference The name of the reference event. NumRefEvents The number of reference events. YMin Minimum epoch count for this variable. YMax Maximum epoch count for this variable. Filter Length The length of the interval filter. Algorithm Let ref[i] be the array of timestamps of the reference event, ts[i] be the spike train (each ts is the timestamp) and epochs are specified as EpochStart[j], EpochEnd[j].
2.32. Coherence Analysis Coherence is a measure of the degree of relationship, as a function of frequency, between two time series. Parameters Parameter Description Reference Specifies a reference variable. Max. Freq. Frequency maximum (Hz). Number of Fr. Values Number of frequency values. Window Overlap Percent of window overlaps when calculating FFTs. Show Freq. From An option to show a subset of frequencies. Specifies minimum frequency to be displayed. Show Freq.
TopLeft Specifies the Excel cell where the results are copied. Should be in the form CR where C is Excel column name, R is the row number. For example, A1 is the top-left cell in the worksheet. Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. Y Min Y axis minimum. Y Max Y axis maximum. Spikes The number of spikes used (for neurons or events).
Z = 1 - pow(alpha, 1/(w*L - 1)) where pow(x,y) returns x to the power of y, alpha = 1 - Confidence_Level*0.01, L is the number of overlapped windows w is the correction due to the Hanning window tapering (see eq. (5) and (6) in Kattla and Lowery (2010)). Reference Kattla S, Lowery MM. Fatigue related changes in electromyographic coherence between synergistic hand muscles. Exp Brain Res. 2010 Apr;202(1):89-99. Epub 2009 Dec 12. .
2.33. Spectrogram Analysis This analysis captures the frequency content of continuous variables or neuronal rate histograms. Parameters Parameter Description Max. Freq. Maximum frequency for the spectrograms. If at least one continuous variable is selected, the value of the Maximum Frequency parameter is set as 0.5*Digitizing frequency of the first selected continuous variable. All continuous variables selected for this analysis should have the same digitizing rate. Number of Fr.
Sheet Name The name of the worksheet in Excel where to copy the numerical results. TopLeft Specifies the Excel cell where the results are copied. Should be in the form CR where C is Excel column name, R is the row number. For example, A1 is the top-left cell in the worksheet. Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. Y Min Y axis minimum. Y Max Y axis maximum.
2.34. Perievent Spectrograms This analysis captures the frequency content of continuous variables or neuronal rate histograms in the time windows around reference events. Parameters Parameter Description Reference Reference event. Max. Freq. Maximum frequency for the spectrograms. If at least one continuous variable is selected, the value of the Maximum Frequency parameter is set as 0.5*Digitizing frequency of the first selected continuous variable.
Add to Results / Bin right An option to add an additional vector (containing a right edge of each frequency bin) to the matrix of numerical results. Send to Matlab An option to send the matrix of numerical results to Matlab. See also Matlab Options. Matrix Name Specifies the name of the results matrix in Matlab workspace. Matlab command Specifies a Matlab command that is executed after the numerical results are sent to Matlab.
2.35. Joint ISI Distribution For each spike, a point is calculated where the X coordinate of the point is the current interspike interval and Y coordinate of the point is the preceding interspike interval. The density of these points is shown in the graph. Parameters Parameter Description Min Interval Time axis minimum in seconds. Max Interval Time axis maximum in seconds Bin Bin size in seconds. Log Axis Scale An option to use Log10 axis scales. Matrix Scale Matrix color scale.
Summary of Numerical Results The following information is available in the Summary of Numerical Results Column Description Variable Variable name. YMin Y axis minimum. YMax Y axis maximum. Color Scale Min Color scale minimum. Color Scale Max Color scale maximum. Algorithm If Use Log Bins and Axes option is not selected: Matrix of binCounts[x,y] is created. Each element of the matrix is initialized as zero.
2.36. Autocorrelograms Versus Time This analysis shows the dynamics of the autocorrelograms over time. It calculates multiple autocorrelograms using a "sliding window" in time. Each autocorrelogram is shown as a vertical stripe with colors representing the bin counts. Horizontal axis represents the position of the sliding window in time. Parameters Parameter Description XMin AutoCorr Autocorrelogram time axis minimum in seconds. XMax AutoCorr Autocorrelogram time axis maximum in seconds.
Send to Excel An option to send numerical results or summary of numerical results to Excel. See also Excel Options. Sheet Name The name of the worksheet in Excel where to copy the numerical results. TopLeft Specifies the Excel cell where the results are copied. Should be in the form CR where C is Excel column name, R is the row number. For example, A1 is the top-left cell in the worksheet.
3. Working with Graphics Graphical analysis results in NeuroExplorer can be adjusted by the user to include custom labels, lines and arrows. The topics in this section describe the graphics elements, list the attributes that you can use with them, and show how to customize NeuroExplorer graphics output. 3.1. NeuroExplorer Graphics NeuroExplorer Graph Window shows the graphs as they will be printed on a page.
In this mode, you can add, delete and edit page graphics objects, i.e. the graphics elements that you want to have on the page. Each graph in the page, however, has its own set of graphics objects. Thus, the default graph usually contains the text label that displays the variable name (Neuron04a in this picture): To edit the properties of the graphical objects (like the label "Neuron04a" above) that belong to the graph, you need to switch the Graph Window to the Graph Mode.
• Switch back to the Page Mode: Note that the labels of all graphs are now in new positions. 3.3. Positioning the Graphics Objects Every graphical object in NeuroExplorer has its parent. Thus, the Block of Graphs is a parent of all the page graphics objects. The Graph is a parent of all the objects inside the graph (X and Y axes, variable label, etc.). A position of any graphics object is always specified relative to its parent.
Coordinates and alignment options shown in this dialog are for the text label in the following graph: This text object is located to the right of the graph, so the X coordinate is 1.05 with the Graph Size units and horizontal alignment Left. The object is centered vertically relative to the graph, so its Y coordinate is 0.5 with the Graph Size units and vertical alignment Center. 3.4.
To specify the exact position of the text object, use the Location page of the dialog. See Positioning the Graphics Objects for details. To specify the text of the label, type the text of the label in the Text field. In many cases there is a need to specify a text that depends on the opened data file, the variable in the graph, etc. NeuroExplorer uses Template Strings to accomplish this task. Template String is a string enclosed in brackets (for example, ).
To edit the properties of the line, double-click at the line. The following dialog will be displayed: Line thickness and the size of the arrow are specified in points (1/72th of the inch). To specify the exact position of the line, use the Location page of the dialog. See Positioning the Graphics Objects for details. 3.6. Rectangles To add a rectangle in the NeuroExplorer Graph Window: • • • • • Select Insert | Rectangle menu command Move mouse pointer to the Graph Window.
4. Working with 3D Graphics NeuroExplorer 3D Graphics Module adds high quality 3D graphics to NeuroExplorer. It was always possible before to export the analysis results from NeuroExplorer to Matlab and then create the 3D graphs in Matlab. However, it would require a considerable amount of time and effort to create the properly labeled 3D graph in Matlab. With the NeuroExplorer 3D Module installed, a single click of a button will display in NeuroExplorer a highly customizable and properly labeled 3D graph.
4.1. Viewing Multiple Histograms in 3D To view a set of histograms in 3 dimensions: • • Calculate the histograms by applying any of the histogram analyses (Rate Histograms, Interspike Interval Histograms, Auto- and Cross-correlograms, Perievent Histograms, etc.) Select 3D | View Histograms in 3D menu command. NeuroExplorer will open the 3D Viewer window and all the histograms in the NeuroExplorer graphics view will be shown in a 3D graph: Note that all the histograms are shown in the same scale.
4.2. 3D Graphics Parameters 3D Template - allows you to choose the 3D Template. When you start using 3D Module, only one 3D Template, Default is available. You can add templates by saving any set of 3D graphics parameters as a new template (to do this, use 3DView | Save As New 3D Template menu command). Graph Type - allows you to choose the graph type. Draw Lines - an option to draw mesh or contour lines. Z Color Scale - an option to use color scale in the graph.
4.3. Viewing the Neuronal Activity "Movie" To view a 'movie' of neuronal activity: • Open the data file. Next, you need to specify the positions of neurons. Neuron positions are saved in a NeuroExplorer data file, so you only need to do this once. • Press Positions button in the Variables sheet of the Data View: • Specify the positions of neurons in the Positions Dialog Box.
You may want to change the 3D graph properties to get the smooth surface shown above. To change the graph properties, right-click in the 3D Viewer window and select Graphics Parameters menu command. Select Surface plot type and enable Gaussian Smoothing. For more information on 3D Viewer options and parameters, see 3D Graphics Parameters. For more information on Activity Animation options and parameters, see Activity Animation Parameters.
4.4. Activity Animation Parameters Animation Template - allows you to choose the Animation Template. When you start using 3D Module, only one Animation Template, Default is available. You can add templates by saving any set of Animation parameters as a new template (to do this, use 3DView | Save As New Animation Template menu command). Reference - if this parameter is None, NeuroExplorer shows the rate histograms-based animation (that is, neuronal activity in real time).
5. Programming with NexScript NeuroExplorer has a powerful scripting language (NexScript) resembling the Matlab language. To create a script, select the Script | New Script menu command. To open existing script, double-click at the script name in the Scripts View. NeuroExplorer will open NexScript editor: NexScript editor has two docked panels: Functions Panel and Output Panel. In the Functions Panel, you cal click at the function name to display function description.
x = 0 If the statement is very long, you can use the line continuation symbol (backslash \) to indicate that the next line contains the continuation of the current line. For example, instead of: Dialog(doc, "D:\Plexon\data\mydata\*.plx", "Filter", "string") you can write: Dialog(doc, "D:\Plexon\data\mydata\*.
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.
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.
You can also add intervals to an interval variable using NexScript functions. See Properties of Variables and Adding Data to Variables for details. Continuous Variables ContVar[i,1] gives you read-only access to the timestamp of the i-th data point. ContVar[i,2] gives you read-write access to the value of the i-th data point. For example, the following script prints the timestamp and the value of the fifth data point in variable ContChannel01: Trace("ts = ", doc.ContChannel01[5,1], "value =" ,doc.
The operation is specified in the top left corner of the dialog. When you select an operation, an operation description is shown in the central panel of the dialog. When you press Run the Operation button, the specified operation is performed and a script line is added to the 'Operations Performed' window at the bottom of the dialog. You can save the list of operations in a NexScript file if you press the "Save.." button.
5.4. Flow Control Loops NexScript supports two types of loops: for loops and while loops. for loop has the following syntax: for variable = expression to expression statements ... end Example: for i = 1 to 10 SelectVar(doc, i, "neuron") end while loop has the following syntax: while logical_expression statements ... end Example: i = 1 while i < 10 SelectVar(doc, i, "neuron") i = i + 1 end break break statement causes an immediate exit from the loop.
Conditional operators Operator if has the following syntax: if logical_expression statements ... end or if logical_expression statements ... else statements ...
5.5. Functions The following function categories are available in NexScript Category Description File Read and Write Functions Functions to read data and text files, save data and results. Document Properties Functions to access general document properties such as file name and comment. Document Variables and Adding New Variables Functions to get the number of spike trains, etc. in the document; to get variable by name; to add new variables to the document.
5.5.1. File Read and Write Functions The following file read and write functions are available in NexScript Function Description GetFileCount Returns the number of files that match the specified file filter. GetFileName Returns the file name for the specified index after GetFileCount() was called. OpenFile Opens text file using the specified mode, returns file ID. CloseFile Closes the file. ReadLine Reads a line from the specified text file.
5.5.1.1. GetFileCount Function GetFileCount Function Returns the number of files that match the file filter. Syntax double GetFileCount(string fileFilter) Parameters Parameter fileFilter Type Description string File filter specification. Can contain wildcards (*). For example, to get all .nex files in folder C:\data\, use filter "C:\data\*.nex". Returns Returns the number of files that match file filter. Comments None Usage NexScript % repeat analysis for all .
5.5.1.2. GetFileName Function GetFileName Function Returns the file name for the specified index after GetFileCount() was called. Syntax GetFileName(double index) Parameters Parameter index Type double Description Index of the file in the file list created by the last call to GetFileCount. Returns Returns the file name (the full path of the file) for the specified index after GetFileCount() was called. Comments None Usage NexScript % repeat analysis for all .
5.5.1.3. OpenFile Function OpenFile Function Opens text file using the specified mode, returns file ID. Syntax double OpenFile(string filePath, string mode) Parameters Parameter Type Description filePath string Full path of the file. mode string File open mode. Can be either "r", "rt" (read), "w" or "wt" (write). Returns Returns file ID. Comments None Usage NexScript % open a file in read mode file = OpenFile("C:\parameters.
5.5.1.4. CloseFile Function CloseFile Function Closes the specified file. Syntax CloseFile(fileID) Parameters Parameter fileID Type double Description File ID received from OpenFile function. Returns None Comments None Usage NexScript % open a file in read mode file = OpenFile("C:\parameters.
5.5.1.5. ReadLine Function ReadLine Function Reads a line from the text file. Syntax double ReadLine(fileID, string lineString) Parameters Parameter Type Description fileID double File ID received from OpenFile function. lineString string String that receives the text from the file. Returns Returns 1 if more text to read is available in the file, otherwise, returns 0. Comments None Usage NexScript % open a file in read mode file = OpenFile("C:\parameters.
5.5.1.6. WriteLine Function WriteLine Function Writes a line of text to a text file. Syntax WriteLine(fileID, lineString) Parameters Parameter Type Description fileID double File ID received from OpenFile function. lineString string The string to be written to the file. Returns None Comments None Usage NexScript % open a file in write mode fileID = OpenFile("C:\results.
5.5.1.7. OpenDocument Function OpenDocument Function Opens a data file with the specified path. Returns a reference to the opened document. Syntax documentReference OpenDocument(string filePath) Parameters Parameter filePath Type Description string Full path of the file. Returns Returns a reference to the opened document. The function returns zero (invalid document reference) if OpenDocument operation failed.
5.5.1.8. NewDocument Function NewDocument Function Creates a new document (data file) with the specified timestamp frequency. Syntax documentReference NewDocument(frequency) Parameters Parameter frequency Type double Description Timestamp frequency. Returns Returns the reference to the new document. Comments None Usage NexScript doc = NewDocument(25000.
5.5.1.9. CloseDocument Function CloseDocument Function Closes the specified document. Syntax CloseDocument(doc) Parameters Parameter doc Type Description documentReference Reference to the document.
5.5.1.10. SaveDocument Function SaveDocument Function Saves the specified document. Syntax SaveDocument(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns None Comments Document is saved as a .nex file.
5.5.1.11. SaveDocumentAs Function SaveDocumentAs Function Saves the specified document (in .nex format) in a file with the specified file path. Syntax SaveDocumentAs(doc, filePath) Parameters Parameter Type Description doc documentReference Reference to the document. filePath string File path. Returns None Comments None Usage NexScript doc = GetActiveDocument() SaveDocumentAs(doc, "C:\data\file1.
5.5.1.12. SaveNumResults Function SaveNumResults Function Saves the numerical results to a text file with the specified name. Syntax SaveNumResults(doc, fileName) Parameters Parameter Type Description doc documentReference Reference to the document. fileName string File path for saved results. Returns None Comments None Usage NexScript doc = GetActiveDocument() SaveNumResults(doc, "C:\results\res1.
5.5.1.13. SaveNumSummary Function SaveNumSummary Function Saves the summary of numerical results to a text file with the specified name. Syntax SaveNumSummary(doc, filename) Parameters Parameter Type Description doc documentReference Reference to the document. filename string File path for saved results. Returns None Comments None Usage NexScript doc = GetActiveDocument() SaveNumSummary(doc, "C:\results\res1summary.
5.5.1.14. SaveAsTextFile Function SaveAsTextFile Function Saves the document in the text file with the specified file name. Syntax SaveAsTextFile(doc, filePath) Parameters Parameter Type Description doc documentReference Reference to the document. filePath string Text file path. Returns None Comments This function uses options that were specified the last time the menu command File | Export Data | As Text File was executed.
5.5.1.15. MergeFiles Function MergeFiles Function Opens and merges the specified files, returns the reference to the merged file. Syntax documentReference MergeFiles(name_list, gap) Parameters Parameter Type Description name_list string The list of files to be merged. File names should be separated by "+". gap number Gap between the files (in seconds). See comments below. Returns Returns the reference to the merged file.
5.5.1.16. ReadBinary Function ReadBinary Function Reads a binary value of a specified type from a file. Syntax double ReadBinary(fileID, valueType) Parameters Parameter Type Description fileID double File ID received from OpenFile function. valueType string Binary type. Should be "char", "uchar", "short", "ushort", "int", "uint", "int64", "uint64", "float" or "double". Returns The value read from the file.
5.5.1.17. FileSeek Function FileSeek Function Repositions file pointer by the specified offset. Syntax double FileSeek(fileID, offset, type) Parameters Parameter Type Description fileID double File ID received from OpenFile function. offset double Number of bytes to move the file pointer. type string Pointer movement mode. Should be "begin", "current" or "end". Returns The new byte offset from the beginning of the file. Comments FileSeek(file,0,"end") returns file size in bytes.
5.5.1.18. SelectFile Function SelectFile Function Opens File Open dialog and returns the path of the file selected in the dialog. Syntax string SelectFile() Returns Returns the path of the file selected in File Open dialog.
5.5.2. Document Properties Functions The following document properties functions are available in NexScript Function Description GetDocPath Returns the full path of the data file. GetDocTitle Returns the data file name. GetTimestampFrequency Returns the frequency used in the specified file to store the timestamps. GetDocEndTime Returns the maximum timestamp value (in seconds) for all the document variables. SetDocEndTime Sets the length of experimental session (in seconds) for the document.
5.5.2.1. GetDocPath Function GetDocPath Function Returns the full path of the data file. Syntax string GetDocPath(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the full path of the data file.
5.5.2.2. GetDocTitle Function GetDocTitle Function Returns the data file name. Syntax string GetDocTitle(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the data file name. For example, if the document has the path "C:\Data\data1.nex", this function will return "data1.
5.5.2.3. GetTimestampFrequency Function GetTimestampFrequency Function Returns the frequency used in the internal representation of the timestamps. Syntax double GetTimestampFrequency(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the frequency used in the specified file to store the timestamps. Comments Internally, the timestamps are stored as integers representing the number of time ticks from the start of the experiment.
5.5.2.4. GetDocEndTime Function GetDocEndTime Function Returns the maximum timestamp value (in seconds) for all the document variables. Syntax double GetDocEndTime(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the maximum timestamp value (in seconds) for all the document variables.
5.5.2.5. SetDocEndTime Function SetDocEndTime Function Sets the length of experimental session for the document. Syntax SetDocEndTime(doc, endtime) Parameters Parameter Type Description doc documentReference Reference to the document. endtime double Document end time in seconds. Returns None Comments NeuroExplorer determines document end time when the document is loaded. Then, the duration of experimental session (endTime - startTime) may be used in the calculations of the confidence limits.
5.5.2.6. GetDocComment Function GetDocComment Function Returns the document comment string. Syntax string GetDocComment(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the document comment string.
5.5.3. Document Variables Functions The following document variables functions are available in NexScript Function Description GetVarCount Returns the number of variables of the specified type in the file. GetVarName Returns a string -- the name of the variable of the specified type in the file. GetVarSpikeCount Returns the number of timestamps in the variable. GetVar Returns the reference to the specified variable. DeleteVar Deletes the specified variable from the file.
5.5.3.1. GetVarCount Function GetVarCount Function Returns the number of variables of the specified type in the file. Syntax double GetVarCount(doc, varType) Parameters Parameter Type Description doc documentReference Reference to the document. varType string Variable type. Should be "neuron", "neuronorevent" , "event", "interval" "wave", "popvector", "continuous", "marker" or "all". Returns Returns the number of variables of the specified type in the file.
5.5.3.2. GetVarName Function GetVarName Function Returns the name of the specified variable. Syntax string GetVarName(doc, number, varType) Parameters Parameter Type Description doc documentReference Reference to the document. number double 1-based variable number within the group specified by varType. varType variableReference Variable type. Should be "neuron", "neuronorevent" , "event", "interval" "wave", "popvector", "continuous", "marker" or "all".
5.5.3.3. GetVarSpikeCount Function GetVarSpikeCount Function Returns the number of timestamps in the specified variable. Syntax double GetVarSpikeCount(doc, number, varType) Parameters Parameter Type Description doc documentReference Reference to the document number double 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".
5.5.3.4. GetVar Function GetVar Function Returns the reference to the specified variable. Syntax variableReference GetVar(doc, number, varType) Parameters Parameter Type Description doc documentReference Reference to the document number double 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".
5.5.3.5. DeleteVar Function DeleteVar Function Deletes the specified variable from the file. Syntax DeleteVar(doc, number, varType) Parameters Parameter Type Description doc documentReference Reference to the document. number double 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".
5.5.3.6. Delete Function Delete Function Deletes the specified variable from the file. Syntax Delete(doc, var) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. Returns None Comments All the analysis windows are closed before executing this function.
5.5.3.7. GetVarByName Function GetVarByName Function Returns the reference to the variable which has the specified name. Syntax variableReference GetVarByName(doc, name) Parameters Parameter Type Description doc documentReference Reference to the document. name string Variable name. Returns Returns the reference to the variable which has the specified name.
5.5.3.8. NewEvent Function NewEvent Function Creates a new timestamped variable. Syntax variableReference NewEvent(doc, count) Parameters Parameter Type Description doc documentReference Reference to the document. count double Initial number of the timestamps in the document. Returns Returns a reference to the new variable. Comments None Usage NexScript doc = GetActiveDocument() temp = NewEvent(doc, 10) % creates a script-only variable doc.
5.5.3.9. NewIntEvent Function NewIntEvent Function Creates a new interval variable. Syntax variableReference NewIntEvent(doc, count) Parameters Parameter Type Description doc documentReference Reference to the document. count double Initial number of intervals in the variable. Returns Returns a reference to the new variable.
5.5.3.10. NewPopVector Function NewPopVector Function Creates a new population vector. Syntax variableReference NewPopVector(doc, type) Parameters Parameter Type Description doc documentReference Reference to the document. type double if type = 0, all weights of the new vector are equal to zero. Returns Returns a reference to the new vector. Comments None Usage NexScript doc = GetActiveDocument() doc.
5.5.3.11. GetContNumDataPoints Function GetContNumDataPoints Function Returns the number of data points in the continuous variable. Syntax double GetContNumDataPoints(var) Parameters Parameter var Type Description variableReference Reference to a continuous variable. Returns Returns the number of data points in the continuous variable.
5.5.3.12. NewContVar Function NewContVar Function Creates a new continuous variable. Syntax variableReference NewContVar(doc, frequency, mVmin, mVmax) Parameters Parameter Type Description doc documentReference Reference to the document. frequency double Specifies the sampling frequency of the new variable (in Hz). mVmin double Minimum of the values of the new variable (in milliVolts). mVmax double Maximum of the values of the new variable (in milliVolts).
5.5.3.13. CopySelectedVarsToAnotherFile Function CopySelectedVarsToAnotherFile Function Copies selected variables from one file to another. Syntax CopySelectedVarsToAnotherFile(fromDoc, toDoc) Parameters Parameter Type Description fromDoc documentReference Reference to the document. The variables are copied from this document. toDoc documentReference Reference to the document. The variables are copied to this document.
5.5.4. Variable Selection Functions The following selection functions are available in NexScript: Function Description IsSelected Returns selection status of the specified variable. Select Selects the specified variable (with variable type and index) for analysis. Deselect Deselects the specified variable (with variable type and index). SelectVar Selects the specified variable for analysis. DeselectVar Deselects the specified variable. SelectAll Selects all variables for analysis.
5.5.4.1. IsSelected Function IsSelected Function Returns 1 if the variable var is selected, 0 otherwise. Syntax double IsSelected(var) Parameters Parameter var Type variableReference Description Reference to the variable. Returns Returns 1 if the variable var is selected, 0 otherwise. Comments Only selected variables used in analysis. Usage NexScript doc = GetActiveDocument() isSel = IsSelected(doc.
5.5.4.2. Select Function Select Function Selects the specified variable for analysis. Syntax Select(doc, var) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.3. Deselect Function Deselect Function Deselects the specified variable. Syntax Deselect(doc, var) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.4. SelectVar Function SelectVar Function Selects the specified variable for analysis. Syntax SelectVar(doc, number, varType) Parameters Parameter Type Description doc documentReference Reference to the document. number double Variable number within the group specified by varType. varType string Variable type. Should be "neuron", "neuronorevent" , "event", "interval" "wave", "popvector", "continuous", "marker" or "all". Returns None Comments Only selected variables used in analysis.
5.5.4.5. DeselectVar Function DeselectVar Function Deselects the specified variable. Syntax DeselectVar(doc, number, varType) Parameters Parameter Type Description doc documentReference Reference to the document. number double Variable number within the group specified by varType. varType string Variable type. Should be "neuron", "neuronorevent" , "event", "interval" "wave", "popvector", "continuous", "marker" or "all". Returns None Comments Only selected variables used in analysis.
5.5.4.6. Select Function Select Function Selects the specified variable for analysis. Syntax Select(doc, var) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.7. Deselect Function Deselect Function Deselects the specified variable. Syntax Deselect(doc, var) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.8. SelectAll Function SelectAll Function Selects all the variables for analysis. Syntax SelectAll(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.9. DeselectAll Function DeselectAll Function Deselects all variables. Syntax DeselectAll(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.10. SelectAllNeurons Function SelectAllNeurons Function Selects all neuron type variables for analysis. Syntax SelectAllNeurons(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.11. SelectAllEvents Function SelectAllEvents Function Selects all event type variables for analysis. Syntax SelectAllEvents(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns None Comments Only selected variables used in analysis. Use select and deselect functions to specify what variables you want to analyze.
5.5.4.12. EnableRecalcOnSelChange Function EnableRecalcOnSelChange Function Enables recalculation of analyses when the list of selected variables changes. Syntax EnableRecalcOnSelChange () Parameters None Returns None Comments If there is an analysis window open in NeuroExplorer (for example, if an analysis window was open before script began or ApplyTemplate was called in the script) and a list of selected variables changes, NeuroExplorer can automatically recalculate the analysis results.
5.5.4.13. DisableRecalcOnSelChange Function DisableRecalcOnSelChange Function Disables recalculation of analyses when the list of selected variables changes. Syntax DisableRecalcOnSelChange() Parameters None Returns None Comments If there is an analysis window open in NeuroExplorer (for example, if an analysis window was open before script began or ApplyTemplate was called in the script) and a list of selected variables changes, NeuroExplorer can automatically recalculate the analysis results.
5.5.5. Properties of Variables Functions The following functions that can get or change properties of variables are available in NexScript Function Description GetName Returns the name of the variable. GetSpikeCount Returns the number of timestamps in the variable. AddTimestamp Adds a new timestamp to the specified variable. SetNeuronType Changes the type of the timestamp variable to either 'neuron' or 'event'. AddContValue Adds a new data point to the specified continuous variable.
5.5.5.1. GetName Function GetName Function Returns the name of the variable. Syntax string GetName(var) Parameters Parameter var Type variableReference Description Reference to the variable. Returns Returns the name of the variable.
5.5.5.2. GetSpikeCount Function GetSpikeCount Function Returns the number of timestamps in the variable. Syntax double GetSpikeCount(var) Parameters Parameter var Type variableReference Description Reference to the variable. Returns Returns the number of timestamps in the variable.
5.5.5.3. AddTimestamp Function AddTimestamp Function Adds a new timestamp to the specified event or neuron variable. Syntax AddTimestamp(var, timestamp) Parameters Parameter Type Description var variableReference Reference to the event or neuron variable. timestamp double New timestamp (in seconds). Returns None Comments The new timestamp should not be equal to one of the existing timestamps of the specified variable.
5.5.5.4. SetNeuronType Function SetNeuronType Function Changes the type of the specified timestamped variable. Syntax SetNeuronType(doc, var, type) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. type double If type is positive, the variable type is set to 'neuron', if type is zero or negative, the variable type is set to 'event'. Returns None Comments Neuron and event types are almost identical.
5.5.5.5. AddContValue Function AddContValue Function Adds a new data point to the specified continuous variable Syntax AddContValue(var, timestamp, value) Parameters Parameter Type Description var variableReference Reference to the continuous variable. timestamp double Timestamps value in seconds. value double Voltage value in millivolts. Returns None Comments None Usage NexScript doc = GetActiveDocument() contVar = GetVarByName(doc, "ContVar1") % add voltage value of 25.
5.5.5.6. AddInterval Function AddInterval Function Adds a new interval to the specified interval variable. Syntax AddInterval(var, interval_start, interval_end) Parameters Parameter Type Description var variableReference Reference to the interval variable. interval_start double Start of new interval (in seconds). interval_end double End of new interval (in seconds). Returns None Comments The new interval should not overlap with any of the existing intervals of the specified interval variable.
5.5.6. Analysis Functions The following analysis functions are available in NexScript Function Description ApplyTemplate Runs the analysis specified in the template. ApplyTemplateToWindow Runs the analysis specified in the template and shows the result in the specified Graph window. EnableRecalcOnSelChange Enables recalculation of analyses when the list of selected variables changes. DisableRecalcOnSelChange Disables recalculation of analyses when the list of selected variables changes.
5.5.6.1. ApplyTemplate Function ApplyTemplate Function Runs the analysis specified in the analysis template. Syntax ApplyTemplate(doc, templateName) Parameters Parameter Type Description documentReference doc Reference to the document. string templateName The name of the template.
5.5.6.2. ApplyTemplateToWindow Function ApplyTemplateToWindow Function Runs the analysis specified in the template and shows the result in the specified Graph window. Syntax ApplyTemplateToWindow(doc, templatename, windownumber) Parameters Parameter Type Description documentReference doc Reference to the document. string templatename The name of the template. double windownumber The number of the graph window of the document. Graph windows are named Graphs1, Graphs2, etc.
5.5.6.3. PrintGraphics Function PrintGraphics Function Prints the contents of the first graphical window of the document. Syntax PrintGraphics(doc) Parameters Parameter doc Type Description documentReference Reference to the document.
5.5.6.4. Dialog Function Dialog Function Shows a dialog that can be used to specify the script parameters. Syntax double Dialog(doc, par1, name1, type1, par2, name2, type2, ...) Parameters Parameter Type Description doc documentReference Reference to the document. Could be zero if all the type values are "number" or "string". par1 variable A variable that will be assigned a value after Dialog exits.
The following script will allow a user to choose one of the neurons in the active document and select this neuron for analysis: doc = GetActiveDocument() Neuron_Number = 1 % choose a neuron res = Dialog(doc, Neuron_Number, "Select Neuron", "neuron") % get the neuron variable and select it Neuron_Var = GetVar(doc, Neuron_Number, "neuron") Select(doc, Neuron_Var) See Also Introduction to NexScript Programming NexScript Function Categories Page 206
5.5.6.5. ModifyTemplate Function ModifyTemplate Function Modifies one of the template parameters. Syntax ModifyTemplate(doc, templateName, paramName, newParValue) Parameters Parameter Type Description doc documentReference Reference to the document. templateName string The name of the template. paramName string The name of the parameter to be modified. newParValue string The new value of the parameter (as a string).
ModifyTemplate(doc, "Peri", "Graph|Line color", "1") ModifyTemplate(doc, "Peri", "Graph|Fill under line", "0") To change the Y Axis parameter, you need to add YAxis| before the parameter name: ModifyTemplate(doc, "Peri", "YAxis|Max Type", "Fixed") ModifyTemplate(doc, "Peri", "YAxis|Fixed Max", "50.") To change the X Axis parameter, you need to add XAxis| before the parameter name.
5.5.6.6. RecalculateAnalysisInWindow Function RecalculateAnalysisInWindow Function Forces recalculation of analysis in the specified graphic window. Syntax RecalculateAnalysisInWindow(doc, graphWindowNumber) Parameters Parameter Type Description doc documentReference Reference to the document. graphWindowNumber double Index of the Graph window.
5.5.6.7. EnableRecalcOnSelChange Function EnableRecalcOnSelChange Function Enables recalculation of analyses when the list of selected variables changes. Syntax EnableRecalcOnSelChange () Parameters None Returns None Comments If there is an analysis window open in NeuroExplorer (for example, if an analysis window was open before script began or ApplyTemplate was called in the script) and a list of selected variables changes, NeuroExplorer can automatically recalculate the analysis results.
5.5.6.8. DisableRecalcOnSelChange Function DisableRecalcOnSelChange Function Disables recalculation of analyses when the list of selected variables changes. Syntax DisableRecalcOnSelChange() Parameters None Returns None Comments If there is an analysis window open in NeuroExplorer (for example, if an analysis window was open before script began or ApplyTemplate was called in the script) and a list of selected variables changes, NeuroExplorer can automatically recalculate the analysis results.
5.5.6.9. SendGraphicsToPowerPoint Function SendGraphicsToPowerPoint Function Sends the contents of the first graphical window of the document to the specified Power Point presentation. Syntax SendGraphicsToPowerPoint (doc, presentationPath, slideTitle, comment, addParameters, useBitmap) Parameters Parameter Type Description doc documentReference Reference to the document. presentationPath string Path of the presentation file. slideTitle string Slide title. comment string Slide comment.
5.5.6.10. SaveGraphics Function SaveGraphics Function Saves the graphics of rthe first graphics window of the document to a WMF or PNG file. Syntax SaveGraphics(doc, filePath, asPng) Parameters Parameter Type Description doc documentReference Reference to the document. filePath string Graphics file path asPng double If this parameter value is zero, graphics is saved in Windows Metafile format. Otherwise, the graphics is saved in PNG format.
5.5.7. Numerical Results Functions The following numerical results functions are available in NexScript Function Description GetNumRes Returns the value of the specified cell in the Numerical Results Window of the first graphical view of the document. GetNumResNCols Returns the number of columns of the Numerical Results Window of the first graphical view of the document. GetNumResNRows Returns the number of rows of the Numerical Results Window of the first graphical view of the document.
5.5.7.1. GetNumRes Function GetNumRes Function Returns the value of the specified cell in the Numerical Results Window of the first graphical view of the document. Syntax double GetNumRes(doc, row, col) Parameters Parameter Type Description doc documentReference Reference to the document. row double 1-based row number. col double 1-based column number. Returns Returns the numeric value of the specified cell in the Numerical Results Window of the first graphical view of the document.
5.5.7.2. GetNumResNCols Function GetNumResNCols Function Returns the number of columns of the Numerical Results Window of the first graphical view of the document. Syntax double GetNumResNCols(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the number of columns of the Numerical Results Window of the first graphical view of the document.
5.5.7.3. GetNumResNRows Function GetNumResNRows Function Returns the number of rows of the Numerical Results Window of the first graphical view of the document. Syntax double GetNumResNRows(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the number of rows of the Numerical Results Window of the first graphical view of the document.
5.5.7.4. GetNumResColumnName Function GetNumResColumnName Function Returns the name of the specified column of the Numerical Results Window. Syntax string GetNumResColumnName(doc, col) Parameters Parameter Type Description doc documentReference Reference to the document. col number 1-based column number. Returns Returns the name of the column of the Numerical Results Window of the first graphical view of the document.
5.5.7.5. SendResultsToExcel Function SendResultsToExcel Function Sends numerical results (of the first graphics window of the document) to Excel. Syntax SendResultsToExcel(doc, fileName, worksheetName, useFirstEmptyRow, cellName, includeHeader, includeFileName) Parameters Parameter Type Description doc documentReference Reference to the document. fileName string Excel file path. worksheetName string Excel worksheet name.
5.5.7.6. GetNumResSummaryNCols Function GetNumResSummaryNCols Function Returns the number of columns of the Numerical Results Summary Window of the first graphical view of the document. Syntax double GetNumResSummaryNCols(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the number of columns of the Numerical Results Summary Window of the first graphical view of the document.
5.5.7.7. GetNumResSummaryNRows Function GetNumResSummaryNRows Function Returns the number of rows of the Numerical Results Summary Window of the first graphical view of the document. Syntax double GetNumResSummaryNRows(doc) Parameters Parameter doc Type Description documentReference Reference to the document. Returns Returns the number of rows of the Numerical Results Summary Window of the first graphical view of the document.
5.5.7.8. GetNumResSummaryColumnName Function GetNumResSummaryColumnName Function Returns the name of the specified column of the Numerical Results Summary Window of the first graphical view of the document. Syntax string GetNumResSummaryColumnName(doc, col) Parameters Parameter Type Description doc documentReference Reference to the document. col double 1-based column number. Returns Returns the name of the column of the Numerical Results Summary Window of the first graphical view of the document.
5.5.7.9. GetNumResSummaryData Function GetNumResSummaryData Function Returns the string value of the specified cell in the Numerical Results Summary Window of the first graphical view of the document. Syntax string GetNumResSummaryData(doc, row, col) Parameters Parameter Type Description doc documentReference Reference to the document row double 1-based row number. col double 1-based column number.
5.5.7.10. SendResultsSummaryToExcel Function SendResultsSummaryToExcel Function Sends summary of numerical results (of the first graphics window of the document) to Excel. Syntax SendResultsSummaryToExcel(doc, fileName, worksheetName, useFirstEmptyRow, cellName, includeHeader, includeFileName) Parameters Parameter Type Description doc documentReference Reference to the document. fileName string Excel file path. worksheetName string Excel worksheet name.
5.5.7.11. SaveNumResults Function SaveNumResults Function Saves the numerical results to a text file with the specified name. Syntax SaveNumResults(doc, fileName) Parameters Parameter Type Description doc documentReference Reference to the document. fileName string File path for saved results. Returns None Comments None Usage NexScript doc = GetActiveDocument() SaveNumResults(doc, "C:\results\res1.
5.5.7.12. SaveNumSummary Function SaveNumSummary Function Saves the summary of numerical results to a text file with the specified name. Syntax SaveNumSummary(doc, filename) Parameters Parameter Type Description doc documentReference Reference to the document. filename string File path for saved results. Returns None Comments None Usage NexScript doc = GetActiveDocument() SaveNumSummary(doc, "C:\results\res1summary.
5.5.8. Operations on Variables Functions The following operations on variables functions are available in NexScript Function Description Rename Renames the specified variable. Join Creates the new event that contains both the timestamps of var1 and the timestamps of var2. Sync Creates the new event containing all the timestamps of var1 that are in the intervals [var2+from, var2+to].
intEndVar (tend), it looks for the last timestamp (tstart) of the intStartVar before tend. If tstart is after the previous timestamp of intEndVar, it adds the interval [tstart+shift1, tend+shift2] to the result. IntOpposite Creates a new interval variable that contains intervals 'complementary' to the intervals of intervalvar. IntOr Creates a new Interval Variable that contains unions of the intervals of intervalVar1 and intervalVar2.
5.5.8.1. Rename Function Rename Function Renames the specified variable. Syntax Rename(doc, var, newName) Parameters Parameter Type Description doc documentReference Reference to the document. var variableReference Reference to the variable. newName string The new name of the variable. Returns None Comments Use this function when you need to assign the variable name generated in the script. Usage NexScript doc = GetActiveDocument() doc.
5.5.8.2. Join Function Join Function Creates the new event that contains the timestamps of the two specified variables. Syntax variableReference Join(var1, var2) Parameters Parameter Type Description var1 variableReference Reference to the variable. var2 variableReference Reference to the variable. Returns Reference to the new variable. Comments Creates the new event that contains both the timestamps of var1 and the timestamps of var2. Usage NexScript doc = GetActiveDocument() doc.
5.5.8.3. Sync Function Sync Function Creates the new event containing all the timestamps of var1 that are in the intervals [var2+from, var2+to]. Syntax variableReference Sync(var1, var2, from, to) Parameters Parameter Type Description var1 variableReference Reference to the variable. var2 variableReference Reference to the variable. from double Offset minimum (seconds). to double Offset maximum (seconds). Returns Reference to the new variable.
5.5.8.4. NotSync Function NotSync Function Creates the new event containing all the timestamps of var1 that are NOT in the intervals [var2+from, var2+to]. Syntax variableReference NotSync(var1, var2, from, to) Parameters Parameter Type Description var1 variableReference Reference to the variable. var2 variableReference Reference to the variable. from double Offset minimum (seconds). to double Offset maximum (seconds). Returns Reference to the new variable.
5.5.8.5. FirstAfter Function FirstAfter Function Creates the new event containing the first timestamp of var1 in each of the intervals [var2+from, var2+to]. Syntax variableReference FirstAfter(var1, var2, from, to) Parameters Parameter Type Description var1 variableReference Reference to the variable. var2 variableReference Reference to the variable. from double Offset of interval start around var2 timestamps. to double Offset of interval end around var2 timestamps.
5.5.8.6. FirstNAfter Function FirstNAfter Function Creates the new event containing the first N timestamps of one variable after each of the timestamps of the second variable. Syntax variableReference FirstNAfter(var1, var2, count) Parameters Parameter Type Description var1 variableReference Reference to the variable. var2 variableReference Reference to the variable. count double How many timestamps of var1 (that are after each timestamp of var2) to copy to the result.
5.5.8.7. LastBefore Function LastBefore Function Creates the new event containing the last timestamp of var1 in each of the intervals [var2+from, var2+to]. Syntax variableReference LastBefore(var1, var2, from, to) Parameters Parameter Type Description var1 variableReference Reference to the variable. var2 variableReference Reference to the variable. from double Interval start offset (seconds). to double Interval end offset (seconds). Returns Reference to the new variable.
5.5.8.8. IntervalFilter Function IntervalFilter Function Creates the new event containing all the timestamps of the specified event or neuron variable that are in the intervals of the specified interval variable. Syntax variableReference IntervalFilter(var, intervalVar) Parameters Parameter Type Description var variableReference Reference to the variable. intervalVar variableReference Reference to the interval variable. Returns Reference to the new variable.
5.5.8.9. SelectTrials Function SelectTrials Function Creates the new event containing the specified timestamps of a variable. Syntax variableReference SelectTrials(var, selectList) Parameters Parameter Type Description var variableReference Reference to the variable. selectList string A list of comma-separated indexes or ranges of timestamps. for example: 1,3-5,10. Returns The reference to the new variable. Comments None Usage NexScript doc = GetActiveDocument() doc.
5.5.8.10. SelectRandom Function SelectRandom Function Creates the new event containing randomly selected timestamps of the specified variable. Syntax variableReference SelectRandom(var, nSelect) Parameters Parameter Type Description var variableReference Reference to the variable. nSelect double Number of timestamps to select. Returns The reference to the new event containing randomly selected timestamps of the specified variable. Comments None Usage NexScript doc = GetActiveDocument() doc.
5.5.8.11. SelectEven Function SelectEven Function Creates the new event containing even (2nd, 4th, etc.) timestamps of the specified variable. Syntax variableReference SelectEven(var) Parameters Parameter var Type variableReference Description Reference to the variable. Returns The reference to the new event containing even (2nd, 4th, etc.) timestamps of the specified variable. Comments None Usage NexScript doc = GetActiveDocument() doc.
5.5.8.12. SelectOdd Function SelectOdd Function Creates the new event containing the odd (1st, 3rd, etc.) timestamps of the specified variable. Syntax variableReference SelectOdd(var) Parameters Parameter var Type variableReference Description Reference to the variable. Returns The reference to the new event containing the odd (1st, 3rd, etc.) timestamps of the specified variable. Comments None Usage NexScript doc = GetActiveDocument() doc.
5.5.8.13. ISIFilter Function ISIFilter Function Creates the new event containing the timestamps of the specified variable that have preceding interspike intervals larger than the specified value. Syntax variableReference ISIFilter(var, minISI) Parameters Parameter Type Description var variableReference Reference to the variable. minISI double Minimum ISI (in seconds). Returns Reference to the new variable.
5.5.8.14. FirstInInterval Function FirstInInterval Function Creates the new event. For each interval of the specified interval variable, the first timestamp in this interval is copied to the result. Syntax variableReference FirstInInterval(var, intervalVar) Parameters Parameter Type Description var variableReference Reference to the neuron or event variable. intervalVar variableReference Reference to the interval variable. Returns The reference to the new variable.
5.5.8.15. LastInInterval Function LastInInterval Function Creates the new event. For each interval of the specified interval variable, the last timestamp in this interval is copied to the result. Syntax variableReference LastInInterval(var, intervalVar) Parameters Parameter Type Description var variableReference Reference to the variable. intervalVar variableReference Reference to the interval variable. Returns Reference to the new variable. Comments Creates the new event.
5.5.8.16. StartOfInterval Function StartOfInterval Function Creates the new event. Copies the start of each interval of the specified interval variable to the result. Syntax variableReference StartOfInterval(intervalVar) Parameters Parameter intervalVar Type variableReference Description Reference to the interval variable. Returns Reference to the new variable. Comments Creates the new event. Copies the start of each interval of intervalVar to the result.
5.5.8.17. EndOfInterval Function EndOfInterval Function Creates the new event based on the specified interval variable. Copies the end of each interval of the interval variable to the result. Syntax variableReference EndOfInterval(intervalVar) Parameters Parameter intervalVar Type double Description Reference to an interval variable. Returns Reference to the new variable. Comments Creates the new event based on the specified interval variable.
5.5.8.18. MakeIntervals Function MakeIntervals Function Creates new interval variable with intervals [varTimestamp+shiftmin, varTimestamp+shiftMax]. Syntax variableReference MakeIntervals(var, shiftMin, shiftMax) Parameters Parameter Type Description var variableReference Reference to the variable. shiftMin double Shift minimum in seconds. shiftMax double Shift maximum in seconds. Returns Reference to the new variable.
5.5.8.19. MakeIntFromStart Function MakeIntFromStart Function Creates new interval variable. For each timestamp tstart of intStartVar, it looks for the first timestamp tend of the intEndVar after tstart. If tend is before the next timestamp of intStartVar, it adds the interval [ tstart +shift1, tend +shift2] to the result.
5.5.8.20. MakeIntFromEnd Function MakeIntFromEnd Function Creates new interval variable. For each timestamp tend of the intEndVar, it looks for the last timestamp ( tstart ) of the intStartVar before tend. If tstart is after the previous timestamp of intEndVar, it adds the interval [ tstart +shift1, tend +shift2] to the result. Syntax variableReference MakeIntFromEnd(intStartVar, intEndVar, shift1, shift2) Parameters Parameter Type Description intStartVar variableReference Reference to the variable.
5.5.8.21. IntOpposite Function IntOpposite Function Creates a new interval variable that contains intervals 'complementary' to the intervals of the specified interval variable. Syntax variableReference IntOpposite(intervalvar) Parameters Parameter intervalvar Type variableReference Description Reference to the interval variable. Returns Reference to the new interval variable. Comments Creates a new interval variable that contains intervals 'complementary' to the intervals of intervalvar.
5.5.8.22. IntOr Function IntOr Function Creates a new Interval Variable that contains unions of the intervals of intervalVar1 and intervalVar2. Syntax variableReference IntOr(intervalVar1, intervalVar2) Parameters Parameter Type Description intervalVar1 variableReference Reference to the interval variable. intervalVar2 variableReference Reference to the interval variable. Returns Reference to the new interval variable.
5.5.8.23. IntAnd Function IntAnd Function Creates a new Interval Variable that contains intersections of the intervals of intervalVar1 and intervalVar2. Syntax IntAnd(intervalVar1, intervalVar2) Parameters Parameter Type Description intervalVar1 variableReference Reference to the interval variable. intervalVar2 variableReference Reference to the interval variable. Returns The reference to the new interval variable.
5.5.8.24. IntSize Function IntSize Function Creates a new Interval Variable that contains the intervals with the specified length range. Syntax variableReference IntSize(intervalVar, minInt, maxInt) Parameters Parameter Type Description intervalVar variableReference Reference to the interval variable. minInt double Minimum interval length (in seconds). maxInt double Maximum interval length (in seconds). Returns Reference to the new interval variable.
5.5.8.25. IntFind Function IntFind Function Finds all intervals that contain at least one timestamp of the specified event or neuron variable. Syntax variableReference IntFind(intervalVar, eventVar) Parameters Parameter Type Description intervalVar variableReference Reference to the interval variable. eventVar variableReference Reference to the event or neuron variable. Returns None Comments Creates a new Interval Variable.
5.5.8.26. MarkerExtract Function MarkerExtract Function Creates a new event variable based on existing marker variable. Syntax variableReference MarkerExtract(doc, MarkerVariableName, ExtractString) Parameters Parameter Type Description doc documentReference Reference to the document MarkerVariableName string The name of the marker variable. ExtractString string Extract string. See comments. Returns None Comments ExtractString contains a list of items separated by commas.
5.5.8.27. Shift Function Shift Function Returns a new variable with all the timestamps of variable var shifted in time by shiftBy seconds. Syntax variableReference Shift(var, shiftBy) Parameters Parameter Type Description var variableReference Reference to the variable. shiftBy double Shift value (in seconds). Returns Reference to the new variable. Comments Returns a new variable with all the timestamps of variable var shifted in time by shiftBy seconds.
5.5.8.28. NthAfter Function NthAfter Function Creates the new variable with the N-th timestamp in var1 after each timestamp in var2. Syntax variableReference NthAfter(var1, var2, N) Parameters Parameter Type Description var1 variableReference Reference to the variable var2 variableReference Reference to the variable N double Spike number. Returns Reference to the new variable. Comments Creates the new variable with the N-th timestamp in var1 after each timestamp in var2.
5.5.8.29. PositionSpeed Function PositionSpeed Function Calculates the position speed from X and Y coordinate variables and creates a new continuous variable. Syntax variableReference PositionSpeed(varX, varY, deltaT, smoothRadius) Parameters Parameter Type Description varX variableReference Reference to the variable. varY variableReference Reference to the variable. deltaT double Time step for speed calculation. smoothRadius double Smooth parameter. See Comments.
5.5.8.30. FilterContinuousVariable Function FilterContinuousVariable Function Filters the specified continuous variable using the specified frequency filter. Syntax FilterContinuousVariable(doc, contVar, filteredVarName, filterType, filterOrder, freq1, freq2) Parameters Parameter Type Description doc documentReference Reference to the document. contVar variableReference Reference to the variable. filteredVarName string The name of the filtered variable.
5.5.8.31. LinearCombinationOfContVars Function LinearCombinationOfContVars Function Calculates a linear combination of two continuous variables. Syntax LinearCombinationOfContVars(doc, resultName, contVar1, coeff1, contVar2, coeff2) Parameters Parameter Type Description doc documentReference Reference to the document. resultName string The name of the result. contVar1 variableReference Reference to the first continuous variable.
5.5.8.32. DecimateContVar Function DecimateContVar Function Decimates a continuous variable. Syntax DecimateContVar(doc, resultName, contVar, decimationFactor) Parameters Parameter Type Description doc documentReference Reference to the document. resultName string The name of the decimated continuous variable. contVar variableReference Reference to the variable.
5.5.9. Matlab Functions The following matlab functions are available in NexScript Function Description SendSelectedVarsToMatlab Sends the selected variables to Matlab. ExecuteMatlabCommand Sends the string command to Matlab and executes the command in Matlab. GetVarFromMatlab Gets the specified timestamped variable (array of timestamps) from Matlab. GetContVarFromMatlab Imports the specified matrix containing continuous variable data from Matlab.
5.5.9.1. SendSelectedVarsToMatlab Function SendSelectedVarsToMatlab Function Sends selected variables to Matlab. Syntax SendSelectedVarsToMatlab(doc) Parameters Parameter doc Type Description documentReference Reference to the document.
5.5.9.2. ExecuteMatlabCommand Function ExecuteMatlabCommand Function Sends the string command to Matlab and executes the command in Matlab. Syntax ExecuteMatlabCommand(command) Parameters Parameter command Type string Description Matlab command to be run. Returns None Comments Any valid Matlab command that you can type at Matlab prompt can be used. For example, you can call a Matlab script or a function.
5.5.9.3. GetVarFromMatlab Function GetVarFromMatlab Function Gets the specified neuron or event variable from Matlab. Syntax GetVarFromMatlab(doc, varname, isneuron) Parameters Parameter Type Description doc documentReference Reference to the document. varname string The name of the matrix in Matlab workspace. The matrix should be a double matrix with either one row or one column of data containing timestamps in seconds.
5.5.9.4. GetContVarFromMatlab Function GetContVarFromMatlab Function Imports the specified matrix from Matlab. Each column of the matrix is imported as a continuous variable. Syntax GetContVarFromMatlab(doc, MatrixName, TimestampOfFirstValue, TimeStep) Parameters Parameter Type Description doc documentReference Reference to the document. MatrixName string The name of a matrix in Matlab workspace.
5.5.9.5. GetContVarWithTimestampsFromMatlab Function GetContVarWithTimestampsFromMatlab Function Imports the specified 2-column matrix containing continuous variable data from Matlab. Syntax GetContVarWithTimestampsFromMatlab(doc, MatrixName, UseFirstDeltaAsDigRate) Parameters Parameter Type Description doc documentReference Reference to the document MatrixName string UseFirstDeltaAsDigRat double (0 or 1) e The name of the Matrix in Matlab workspace.
5.5.9.6. GetIntervalVarFromMatlab Function GetIntervalVarFromMatlab Function Imports the specified matrix containing intervals from Matlab. Syntax GetIntervalVarFromMatlab(doc, MatrixName) Parameters Parameter Type Description doc documentReference Reference to the document. MatrixName string The name of the 2-column matrix in Matlab workspace. Returns None Comments Imports the specified 2-column matrix from Matlab.
5.5.10. Excel Functions The following Excel functions are available in NexScript Function Description SetExcelCell Sets the text value of the specified cell in Excel. CloseExcelFile Closes the specified Excel file if the file is open. SendResultsToExcel Sends numerical results (of the first graphics window of the document) to Excel. SendResultsSummaryToExcel Sends summary of numerical results (of the first graphics window of the document) to Excel.
5.5.10.1. SetExcelCell Function SetExcelCell Function Sets the text value of the specified cell in Excel. Syntax SetExcelCell(worksheet, cell, text, excelFilePath) Parameters Parameter Type Description worksheet string The name of the worksheet. cell string Excel cell specification, Should be in the form CR where C is Excel column name, R is the row number. For example, "A1" is the top-left cell in the worksheet. text string The text to be copied to the cell.
5.5.10.2. CloseExcelFile Function CloseExcelFile Function Closes the specified Excel file if the file is open. Syntax CloseExcelFile(filePath) Parameters Parameter filePath Type string Description Full path of the Excel file. Returns None Comments None Usage NexScript excelFilePath = "C:\data\NexResults.
5.5.11. Power Point Functions The following power point functions are available in NexScript Function Description SendGraphicsToPowerPoint Sends analysis graphics to the specified Power Point file. ClosePowerPointFile Closes the specified Power Point file if the file is open.
5.5.11.1. SendGraphicsToPowerPoint Function SendGraphicsToPowerPoint Function Sends the contents of the first graphical window of the document to the specified Power Point presentation. Syntax SendGraphicsToPowerPoint (doc, presentationPath, slideTitle, comment, addParameters, useBitmap) Parameters Parameter Type Description doc documentReference Reference to the document. presentationPath string Path of the presentation file. slideTitle string Slide title. comment string Slide comment.
5.5.11.2. ClosePowerPointFile Function ClosePowerPointFile Function Closes the specified Power Point file if the file is open. Syntax ClosePowerPointFile(filePath) Parameters Parameter filePath Type string Description Full path of the Power Point file. Returns None Comments None Usage NexScript pptFilePath = "C:\Data\NexResults.
5.5.12. Running Script Functions The following running script functions are available in NexScript Function Description RunScript Runs the script with the specified file name. Sleep Pauses execution of the script.
5.5.12.1. RunScript Function RunScript Function Runs the script with the specified name. Syntax RunScript(scriptName) Parameters Parameter scriptName Type string Description Script name.
5.5.12.2. Sleep Function Sleep Function Pauses execution of the script for nms milliseconds. Syntax Sleep(nms) Parameters Parameter nms Type double Description The number of milliseconds to pause.
5.5.13. Math Functions The following math functions are available in NexScript Function Description seed Initializes random number generator. expo Generates a random value exponentially distributed with the specified mean. floor Returns the largest integer that is less than or equal to the specified number. ceil Returns the smallest integer that is greater than or equal to the specified number. round Rounds the specified number to the nearest integer.
See Also Introduction to NexScript Programming NexScript Function Categories Page 278
5.5.13.1. seed Function seed Function Initializes random number generator. Syntax seed(double iseed) Parameters Parameter iseed Type double Description Numeric seed value. Should be a positive integer.
5.5.13.2. expo Function expo Function Generates a random value exponentially distributed with the specified mean. Syntax double expo(double fmean) Parameters Parameter fmean Type double Description Mean of the exponential distribution.
5.5.13.3. floor Function floor Function Returns the largest integer that is less than or equal to the specified number. Syntax double floor(double x) Parameters Parameter x Type double Description Numeric value. Returns Returns the largest integer that is less than or equal to x. Comments None Usage NexScript x = 1.
5.5.13.4. ceil Function ceil Function Returns the smallest integer that is greater than or equal to the specified number. Syntax double ceil(double x) Parameters Parameter x Type double Description Numeric value. Returns Returns the smallest integer that is greater than or equal to x. Comments None Usage NexScript x = ceil(1.
5.5.13.5. round Function round Function Rounds the specified number to the nearest integer. Syntax round(double x) Parameters Parameter x Type double Description Numeric value. Returns Returns the integer that is closest to x Comments None Usage NexScript y % y % = y = y round(1.3) now is 1 round(1.
5.5.13.6. abs Function abs Function Returns absolute value of the specified number. Syntax double abs(double x) Parameters Parameter x Type double Description Numeric value. Returns Returns absolute value of x.
5.5.13.7. sqrt Function sqrt Function Returns the square root of the specified number. Syntax double sqrt(double x) Parameters Parameter x Type double Description Numeric value (should be non-negative). Returns Returns the square root of x.
5.5.13.8. pow Function pow Function Returns x raised to the power of y. Syntax double pow(double x, double y) Parameters Parameter Type Description x double Number to be raised to the specified power. y double The power. Returns Returns x raised to the power of y.
5.5.13.9. exp Function exp Function Returns exponential of x. Syntax double exp(double x) Parameters Parameter x Type double Description Numeric value. Returns Returns exponential of x. Comments None Usage NexScript y = exp(2.
5.5.13.10. min Function min Function Returns the minimum of two numbers. Syntax double min(double x, double y) Parameters Parameter Type Description x double Numeric value. y double Numeric value. Returns Returns minimum of x and y.
5.5.13.11. max Function max Function Returns maximum of two numbers. Syntax max(double x, double y) Parameters Parameter Type Description x double Numeric value. y double Numeric value. Returns Returns maximum of x and y.
5.5.13.12. log Function log Function Returns logarithm of the specified number. Syntax log(double x) Parameters Parameter x Type double Description Numeric value (the value should be positive). Returns Returns logarithm of x. Comments None Usage NexScript y = log(2.
5.5.13.13. sin Function sin Function Returns sine of the specified number. Syntax sin(double x) Parameters Parameter x Type double Description Numeric value (sine parameter in radians). Returns Returns the sine of x.
5.5.13.14. cos Function cos Function Returns cosine of the specified number. Syntax double cos(double x) Parameters Parameter x Type double Description Numeric value (cosine parameter in radians). Returns Returns cosine of x. Comments None Usage NexScript y = cos(0.
5.5.13.15. tan Function tan Function Returns tangent of the specified number. Syntax tan(double x) Parameters Parameter x Type double Description Numeric value (tangent parameter in radians). Returns Returns tangent of x.
5.5.13.16. acos Function acos Function Returns the arccosine (in radians) of the specified number. Syntax double acos(double x) Parameters Parameter x Type double Description Numeric value (the value should be from -1 to +1). Returns Returns y such that x = cos(y). Comments None Usage NexScript x = 0.5 y = acos(x) % y is 1.
5.5.13.17. asin Function asin Function Returns the arcsine of the specified number. Syntax double asin(double x) Parameters Parameter double Type x Description Numeric value (the value should be from -1 to +1). Returns Returns y such that x = sin(y). Comments None Usage NexScript x = 0.
5.5.13.18. atan Function atan Function Returns the arctangent of the specified number. Syntax double acos(double x) Parameters Parameter double Type x Description Numeric value. Returns Returns y such that x = tan(y).
5.5.13.19. RoundToTS Function RoundToTS Function Rounds the specified number to the nearest timestamp value. Syntax double RoundToTS(doc, time) Parameters Parameter Type Description doc documentReference Reference to the document. time double The time value (in seconds) to be rounded. Returns The document timestamp value (in seconds) nearest to the specified time. Comments None Usage NexScript doc = GetActiveDocument() ts = RoundToTS(doc, 1.
5.5.13.20. GetFirstGE Function GetFirstGE Function Returns the index of the first timestamp in the specified variable that is greater than or equal to the specified number. Syntax double GetFirstGE(var, number) Parameters Parameter Type Description var variableReference Reference to the variable. number double Time value in seconds. Returns Returns the index of the first timestamp in the specified variable that is greater than or equal to the specified number.
5.5.13.21. GetFirstGT Function GetFirstGT Function Returns the index of the first timestamp in the specified variable that is greater than the specified number. Syntax double GetFirstGT(var, number) Parameters Parameter Type Description var variableReference Reference to the variable. number double Time value in seconds. Returns Returns the index of the first timestamp in the specified variable that is greater than the specified number.
5.5.13.22. GetBinCount Function GetBinCount Function Calculates the number of timestamps in the specified time range. Syntax double GetBinCount(var, timeMin, timeMax) Parameters Parameter Type Description var variableReference Reference to a variable. Should be a reference to a neuron, event, interval or continuous variable. timeMin double Time range minimum (in seconds). timeMax double Time range maximum (in seconds).
5.5.13.23. BitwiseAnd Function BitwiseAnd Function Returns the result of the bitwise AND operation. Syntax double BitwiseAnd(value1, value2) Parameters Parameter Type Description value1 double Numeric value. value2 double Numeric value. Returns Result of the bitwise AND operation. Comments value1 and value2 are converted to integers and then bitwise AND operation is applied to these integers.
5.5.13.24. BitwiseOr Function BitwiseOr Function Returns the result of the bitwise OR operation. Syntax double BitwiseOr(value1, value2) Parameters Parameter Type Description value1 double Numeric value. value2 double Numeric value. Returns Result of the bitwise OR operation. Comments value1 and value2 are converted to integers and then the bitwise OR operation is applied to these integers.
5.5.13.25. GetBit Function GetBit Function Returns the value of the specified bit (1 to 32). Syntax double GetBit(number, bitNumber) Parameters Parameter Type Description number double Numeric value. bitNumber double 1-based bin number. 1 is the least significant bit, 32 is the most significant bit. Returns Returns the value (0 or 1) of the specified bit. Comments The first parameter is converted to an unsigned 32-bit integer and then the bit value of this unsigned integer is returned.
5.5.14. String Functions The following string functions are available in NexScript Function Description Left Extracts substring from the left part of the string, returns string. Mid Extracts substring from the middle of the string. Right Extracts substring from the right part of the string. Find Looks for a substring inside the specified string. StrLength Calculates the number of characters in the string, returns number.
5.5.14.1. Left Function Left Function Returns a substring that starts at the beginning of the string. Syntax string Left(string, nchar) Parameters Parameter Type Description string string String parameter. nchar number Number of characters in the substring. Returns Returns a substring that starts at the beginning of the string.
5.5.14.2. Mid Function Mid Function Returns the specified substring. Syntax string Mid(string, nstartchar, nchar) Parameters Parameter Type Description string string String parameter. nstartchar double 1-based index of the start character. nchar double Number of characters to select. Returns Returns the substring that starts at character nstartchar and contains nchar characters.
5.5.14.3. Right Function Right Function Returns a substring that ends at the end of the string. Syntax string Right(string, nchar) Parameters Parameter Type Description string string String parameter. nchar string Number of characters in the substring. Returns Extracts right nchar characters from string, returns string.
5.5.14.4. Find Function Find Function Looks for a substring inside a specified string. Syntax double Find(string1, string2) Parameters Parameter Type Description string1 string The string where we look for a substring. string2 string The substring that we are trying to find. Returns Looks for a string string2 inside the string string1, returns a number - the position of the first character of string2 in the string1. Returns zero is string2 is not found.
5.5.14.5. StrLength Function StrLength Function Calculates the number of characters in the string. Syntax double StrLength(string) Parameters Parameter string Type Description string The string parameter. Returns Returns the number of characters in the string.
5.5.14.6. NumToStr Function NumToStr Function Converts number to string using optional format string. Syntax string NumToStr(number, formatString) Parameters Parameter Type Description number double Number to be converted to string. formatString string Optional format string (a standard C/C++ format specifier). See, for example, http://www.cplusplus.com/reference/clibrary/cstdio/p rintf/ Returns Returns string representing the specified number.
5.5.14.7. StrToNum Function StrToNum Function Converts string to number. Syntax double StrToNum(stringRepresentingNumber) Parameters Parameter Type stringRepresentingNum string ber Description A string containing a valid representation of the number, for example, "1", "002", "123.456". Returns Returns the number corresponding to the specified string.
5.5.14.8. GetNumFields Function GetNumFields Function Returns the number of fields in the string. The field is a substring that does not contain spaces, tabs or commas. Syntax GetNumFields(stringWithFields) Parameters Parameter stringWithFields Type Description string The string containing fields. The field is a substring that does not contain spaces, tabs or commas. Returns Returns the number of fields in the string. The field is a substring that does not contain spaces, tabs or commas.
5.5.14.9. GetField Function GetField Function Returns the string field. Syntax string GetField(stringWithFields, fieldnumber) Parameters Parameter Type Description stringWithFields string The string containing multiple data fields. The field is a substring that does not contain spaces, tabs or commas. fieldnumber double The field number. Returns Returns the field with the specified number as a string. The field is a substring that does not contain spaces, tabs or commas.
5.5.14.10. CharToNum Function CharToNum Function Converts a one-character string to a number (a character's ASCII code). Syntax double CharToNum(oneCharString) Parameters Parameter oneCharString Type string Description A string of length 1 (for example, "a", "5"). Returns The string character's ASCII code.
5.5.14.11. NumToChar Function NumToChar Function Converts a number to a one-character string containing a character with the ASCII code equal to the number. Syntax string NumToChar(number) Parameters Parameter number Type double Description ASCII code of the character. Returns Returns a one-character string containing the character with the ASCII code equal to the specified number.
5.5.15. Debug Functions The following debug functions are available in NexScript Function Description Trace Prints arguments to output window. MsgBox Displays a message box.
5.5.15.1. Trace Function Trace Function Prints arguments to the output window. Syntax Trace(arg1, arg2, ...) Parameters Parameter Type Description arg1 any type String, number or any other valid NexScript value. arg2 any type String, number or any other valid NexScript value. Returns None Comments Converts each parameter to string and the prints the result to the output window.
5.5.15.2. MsgBox Function MsgBox Function This function is equivalent to Trace function.
6. COM/ActiveX Interfaces NeuroExplorer exposes COM (Component Object Model) interfaces that allow other applications to launch and control NeuroExplorer. For example, the following Matlab code starts NeuroExplorer, opens a data file and loads Neuron04a timestamps into the Matlab workspace: nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\TestDataFile1.nex'); neuron = doc.Variable('Neuron04a'); timestamps = neuron.
6.1. Application Application Interface External applications can open an instance of NeuroExplorer using its Program ID "NeuroExplorer.Application". For example, to open NeuroExplorer (or to connect to a running instance of NeuroExplorer) in Matlab , you can use the following command: nex = actxserver('NeuroExplorer.Application'); To open NeuroExplorer in JavaScript, use the following command: var nex = new ActiveXObject("NeuroExplorer.
6.1.1. ActiveDocument Property Application.ActiveDocument Property Read-only property that returns a Document object that represents the active document (the document corresponding to the active window of the application). Returns null if there are no open documents. Syntax Document ActiveDocument Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.ActiveDocument; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.
6.1.2. DocumentCount Property Application.DocumentCount Property Read-only property that returns the number of open documents (data files). Syntax int DocumentCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); numDocs = nex.DocumentCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var numDocs = nex.
6.1.3. Version Property Application.Version Property Read-only property that returns a string with the current version of NeuroExplorer. Syntax string Version Usage Matlab nex = actxserver('NeuroExplorer.Application'); version = nex.Version; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var version = nex.
6.1.4. Visible Property Application.Visible Property Boolean read/write property that controls the visibility of NeuroExplorer. Syntax Boolean Visible Usage Matlab nex = actxserver('NeuroExplorer.Application'); isVisible = nex.Visible; % make sure that NeuroExplorer is visible nex.Visible = true; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var isVisible = nex.Visible; nex.
6.1.5. OpenDocument Method Application.OpenDocument Method Opens the specified data file. Returns Document object if succeeded. Syntax Document OpenDocument ( string documentPath ) Parameters Parameter documentPath Type string Description Full data file path Returns Returns Document object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); JavaScript var nex // note // when var doc = new ActiveXObject("NeuroExplorer.
6.1.6. Document Medhod Application.Document Method Returns Document object for the specified document index. Syntax Document Document(int documentIndex) Parameters Parameter documentIndex Type int Description 1-based document index Returns Returns Document object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); % get the first open document doc = nex.Document(1); JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); // get the first open document var doc = nex.
6.1.7. Sleep Method Application.Sleep Method Pauses the application. Syntax void Sleep ( int millisecondsToSleep ) Parameters Parameter millisecondsToSleep Type int Description Number of milliseconds to sleep Returns None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); % pause NeuroExplorer for 1 second nex.Sleep(1000); JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); // pause NeuroExplorer for 1 second nex.
6.1.8. RunNexScript Method Application.RunNexScript Method Runs the specified NexScript. Returns true if succeeded. Syntax bool RunNexScript ( string scriptPath ) Parameters Parameter scriptPath Type string Description Script path. Returns Returns true if script succeeded, otherwise, returns false. Usage Matlab nex = actxserver('NeuroExplorer.Application'); res = nex.RunNexScript('C:\Scripts\TestScript.nsc'); JavaScript var nex // note // when var res = new ActiveXObject("NeuroExplorer.
6.1.9. RunNexScriptCommands Method Application.RunNexScriptCommands Method Runs the specified NexScript text. Returns true if succeeded. Syntax bool RunNexScript ( string script ) Parameters Parameter script Type string Description Script text. Script lines should be separated by \n. Returns Returns true if script succeeded, otherwise, returns false. Usage Matlab nex = actxserver('NeuroExplorer.Application'); res = nex.RunNexScriptCommands('doc=GetActiveDocument()\ndoc.NewEvent = Sync(doc.
6.2. Document Document Interface NeuroExplorer Application object provides access to the open documents. For example, to open a document in NeuroExplorer in Matlab script, you can use: nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); Here OpenDocument method returns a Document object corresponding to the specified data file. The properties and methods of the Document object are listed below.
SelectAllContinuous Selects all the continuous variables in the document ApplyTemplate Runs the analysis specified in the analysis template GetNumericalResults Returns numerical results for the first graph view of the document Close Closes the document See Also COM/ActiveX Interfaces Page 331
6.2.1. Path Property Document.Path Property Read-only property that returns a string with the full path of the document. Syntax string Path Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); path = doc.Path; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var path = doc.
6.2.2. FileName Property Document.FileName Property Read-only property that returns a string with the file name. Syntax string FileName Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); path = doc.Path; fileName = doc.FileName; % path is 'C:\Data\TestDataFile.nex' % fileName is 'TestDataFile.nex' JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var path = doc.
6.2.3. Comment Property Document.Comment Property Read-only property that returns a string with the data file comment. Syntax string Comment Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); comment = doc.Comment; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var comment = doc.
6.2.4. TimestampFrequency Property Document.TimestampFrequency Property Read-only property that returns the timestamp frequency of the document in Hertz. Syntax double TimestampFrequency Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); tsFrequency = doc.TimestampFrequency; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var tsFrequency = doc.
6.2.5. StartTime Property Document.StartTime Property Read-write property that specifies the document data start time (minimum timestamp) in seconds. Syntax double StartTime Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); startTime = doc.StartTime; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var startTime = doc.
6.2.6. EndTime Property Document.EndTime Property Read-write property that specifies the document data end time (maximum timestamp) in seconds. Syntax double EndTime Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); endTime = doc.EndTime; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var endTime = doc.
6.2.7. VariableCount Property Document.VariableCount Property Read-only property that returns the number of variables in the document. Syntax int VariableCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numVars = doc.VariableCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numVars = doc.
6.2.8. NeuronCount Property Document.NeuronCount Property Read-only property that returns the number of neurons in the document. Syntax int NeuronCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numNeurons = doc.NeuronCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numNeurons = doc.
6.2.9. EventCount Property Document.EventCount Property Read-only property that returns the number of event variables in the document. Syntax int EventCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numEventVars = doc.EventCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numEventVars = doc.
6.2.10. IntervalCount Property Document.IntervalCount Property Read-only property that returns the number of interval variables in the document. Syntax int IntervalCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numIntervalVars = doc.IntervalCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numIntervalVars = doc.
6.2.11. MarkerCount Property Document.MarkerCount Property Read-only property that returns the number of marker variables in the document. Syntax int MarkerCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numMarkerVars = doc.MarkerCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numMarkerVars = doc.
6.2.12. WaveCount Property Document.WaveCount Property Read-only property that returns the number of waveform variables in the document. Syntax int WaveCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numWaveVars = doc.WaveCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numWaveVars = doc.
6.2.13. ContinuousCount Property Document.ContinuousCount Property Read-only property that returns the number of continuous variables in the document. Syntax int ContinuousCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); numContinuousVars = doc.ContinuousCount; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); var numContinuousVars = doc.
6.2.14. Variable Method Document.Variable Method Returns Variable object for the specified variable index or name. Syntax Variable Variable(object variableIndexOrName) Parameters Parameter variableIndexOrName Type int or string Description 1-based variable index or a string with the variable name Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first variable var1 = doc.
6.2.15. Neuron Method Document.Neuron Method Returns Variable object for the specified neuron variable index. Syntax Variable Neuron(int neuronIndex) Parameters Parameter neuronIndex Type int Description 1-based neuron variable index Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first neuron variable neuron1 = doc.Neuron(1); % get the last neuron variable neuronLast = doc.Neuron(doc.
6.2.16. Event Method Document.Event Method Returns Variable object for the specified event variable index. Syntax Variable Event(int eventIndex) Parameters Parameter eventIndex Type int Description 1-based event variable index Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first event variable Event1 = doc.Event(1); % get the last event variable EventLast = doc.Event(doc.
6.2.17. Interval Method Document.Interval Method Returns Variable object for the specified interval variable index. Syntax Variable Interval(int IntervalIndex) Parameters Parameter IntervalIndex Type int Description 1-based interval variable index Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first interval variable Interval1 = doc.
6.2.18. Marker Method Document.Marker Method Returns Variable object for the specified marker variable index. Syntax Variable Marker(int markerIndex) Parameters Parameter markerIndex Type int Description 1-based marker variable index Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first marker variable Marker1 = doc.Marker(1); % get the last marker variable MarkerLast = doc.Marker(doc.
6.2.19. Wave Method Document.Wave Method Returns Variable object for the specified waveform variable index. Syntax Variable Wave(int waveIndex) Parameters Parameter waveIndex Type int Description 1-based waveform variable index Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first waveform variable Wave1 = doc.Wave(1); % get the last waveform variable WaveLast = doc.Wave(doc.
6.2.20. Continuous Method Document.Continuous Method Returns Variable object for the specified continuous variable index. Syntax Variable Continuous(int continuousIndex) Parameters Parameter continuousIndex Type int Description 1-based continuous variable index Returns Returns Variable object. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first continuous variable Continuous1 = doc.
6.2.21. DeselectAll Method Document.DeselectAll Method Deselects all the data variables in the document. Syntax void DeselectAll() Returns None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % deselect all variables doc.DeselectAll(); % select one variable doc.Variable('Neuron01').Select(); % run Interspike Interval Histogram analysis saved in 'ISI' template doc.ApplyTemplate('ISI'); % get numerical results results = doc.
6.2.22. SelectAllNeurons Method Document.SelectAllNeurons Method Selects all the neuron variables in the document. Selected variables are used in analysis when ApplyTemplate document method is called. Syntax void SelectAllNeurons() Returns None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % deselect all variables doc.DeselectAll(); % select all neurons doc.
6.2.23. SelectAllContinuous Method Document.SelectAllContinuous Method Selects all the continuous variables in the document. Syntax void SelectAllContinuous() Returns None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % deselect all variables doc.DeselectAll(); % select all continuous variables doc.SelectAllContinuous(); % run Perievent Histogram analysis saved in 'PSTH' template doc.
6.2.24. ApplyTemplate Method Document.ApplyTemplate Method Runs the analysis specified in the analysis template. Syntax void ApplyTemplate(string templateName) Parameters Parameter templateName Type string Description template name Returns None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % deselect all variables doc.DeselectAll(); % select all neurons doc.
6.2.25. GetNumericalResults Method Document.GetNumericalResults Method Returns 2-dimensional array of numerical results for the first graph view of the document. Syntax Array GetNumericalResults() Returns Returns 2-dimensional array of numerical results. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % apply AutoCorrelograms analysis template nex.
6.2.26. Close Method Document.Close Method Closes the document. Syntax void Close() Parameters None. Returns None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % close the document doc.Close(); JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); // close the document doc.
6.3. Variable Variable Interface NeuroExplorer Application object provides access to the open files and variables contained in the files. For example, to open a document in NeuroExplorer and get the first event variable in the document in Matlab, you can use: nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); event1 = doc.Event(1); Here Event() method returns a Variable object corresponding to the first event variable in the file.
6.3.1. Name Property Variable.Name Property Read-only property that returns a string with the variable name. Syntax string Name Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first neuron variable neuron1 = doc.Neuron(1); neuron1Name = neuron1.Name; JavaScript var nex = new ActiveXObject("NeuroExplorer.Application"); var doc = nex.OpenDocument("C:\\Data\\TestDataFile.nex"); // get the first neuron variable var neuron1 = doc.
6.3.2. TimestampCount Property Variable.TimestampCount Property Read-only property that returns the number of timestamps in the variable. For interval variables, returns the number of intervals. For waveforms variable, returns the number of waveforms. For continuous variables, returns the total number of data points. Syntax int TimestampCount Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first neuron variable neuron1 = doc.
6.3.3. Timestamps Method Variable.Timestamps Method Returns all the timestamps of the variable in seconds. Timestamps are returned as an array (vector) of double values. For interval variables, returns the interval starts. For waveforms variable, returns the waveform timestamps. For continuous variables, returns the timestamps corresponding to all the variable data points. Syntax SAFEARRAY(double) Timestamps() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.
6.3.4. IntervalStarts Method Variable.IntervalStarts Method For an interval variable, returns the interval start values in seconds. This method is valid only for interval variables. Syntax SAFEARRAY(double) IntervalStarts() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first interval variable int1= doc.Interval(1); % get all the interval starts int1Starts = int1.
6.3.5. IntervalEnds Method Variable.IntervalEnds Method For an interval variable, returns the interval end values in seconds. This method is valid only for interval variables. Syntax SAFEARRAY(double) IntervalEnds() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first interval variable int1= doc.Interval(1); % get all the interval ends int1Ends = int1.
6.3.6. FragmentTimestamps Method Variable.FragmentTimestamps Method For continuous variable, returns the fragment timestamp values in seconds. This method is valid only for continuous variables. In general, a continuous variable may contain several fragments of data. Each fragment may be of a different length. NeuroExplorer does not store the timestamps for all the A/D values since they would use too much space.
6.3.7. FragmentCounts Method Variable.FragmentCounts Method For continuous variable, returns the number of data points in fragments. This method is valid only for continuous variables. In general, a continuous variable may contain several fragments of data. Each fragment may be of a different length. NeuroExplorer does not store the timestamps for all the A/D values since they would use too much space.
6.3.8. ContinuousValues Method Variable.ContinuousValues Method For continuous variable, returns all the A/D values in milliVolts. This method is valid only for continuous variables. Syntax SAFEARRAY(double) ContinuousValues() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first continuous variable cont1= doc.Continuous(1); % get all the values cont1Values = cont1.
6.3.9. MarkerValues Method Variable.MarkerValues Method For a marker variable, returns all the marker values as strings. The values are returned in a twodimensional array. Each row of the array represents all the marker strings for one timestamp. This method is valid only for marker variables. Syntax SAFEARRAY(string) MarkerValues() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first markervariable marker1 = doc.
6.3.10. WaveformValues Method Variable.WaveformValues Method For waveform variable, returns all the waveform values in milliVolts. The values are returned in a twodimensional array. Each row of the array represents one waveform. This method is valid only for waveform variables. Syntax SAFEARRAY(double) WaveformValues() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % get the first waveform variable wave1= doc.
6.3.11. Select Method Variable.Select Method Selects the variable. Selected variables are used in analysis when ApplyTemplate document method is called. Syntax void Select() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % deselect all variables doc.DeselectAll(); % select variable with the name 'Neuron01' doc.Variable('Neuron01').Select(); % run Interspike Interval Histogram analysis saved in 'ISI' template doc.
6.3.12. Deselect Method Variable.Deselect Method Deselects the variable. Only selected variables are used in analysis when ApplyTemplate document method is called. Syntax void Deselect() Parameters None. Usage Matlab nex = actxserver('NeuroExplorer.Application'); doc = nex.OpenDocument('C:\Data\TestDataFile.nex'); % deselect all variables doc.DeselectAll(); % select all neurons doc.SelectAllNeurons(); % deselect variable with the name 'Neuron01' doc.Variable('Neuron01').
Index 1 F P 1D Data Viewer 24 File Variables 134 Flow Control 137 Functions 139, 140, 159, 166, 180, 194, 201, 214, 227, 261, 268, 271, 274, 277, 304, 316 Graphics 37, 119, 121, 125, 127, 204, 212, 213, 272 Graphics Modes 119 Perievent Histograms 49, 59 Perievent Rasters 72 Perievent Spectrograms 113 Place Cell Analysis 99 Poincare Maps 80 Population Vectors 43 Post-Processing 47 Power Point 33, 271 Power Spectral Densities 85 Principal Component Analysis 91 Programming with NexScript 131 PSTH Versus