OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                           
 

4.51 FAQ-699 What variable names should I avoid using in LabTalk Scripts?

Last Update: 2/16/2015


The following is a list of variable names that you should avoid using when writing LabTalk Scripts. This would extend to places in the GUI -- the Set Values or Programming Control dialogs to name two -- where such variables can be defined and used.

Numeric System Variables

  • X1, X2, X3, Y1, Y2, Y3, Z1, Z2, Z3 - reserved for graph axis ranges
  • MKS1, MKS2 - used by data markers
  • ECHO - used to print scripts or error messages to the Script Window
  • X, Y, Z - used by Origin tools (Screen Reader, Data Reader, Data Selector) to store data point coordinates
  • I, J - used in these and other dialogs to store row and column indices in worksheets and matrixes:
    • Set Column/Matrix Values
    • Column Filter
    • Worksheet Query
    • Function Plots
  • E, T - reserved for internal use
  • Count - used to store counts with, for instance, layer -c or doc -cl commands
  • SELC1, SELC2, SELR1, SELR2 - used for worksheet selection range
  • V1 - V9 - reserved for internal use


For more information, see System Variables

String System Variables

These are automatically assigned system variables created when certain events occur. Their purpose is to keep track of the last-used value of a given object type, such as the last worksheet used or the last LabTalk script command that you issued. These are identifiable by a leading double-underscore "__", as in __LASTWKS or __LastLTcmd.

LabTalk String Registers

String register names have a %-character followed by a single alphabetic character (from A to Z). Ten (10) of these string registers are reserved for use as system variables:

  •  %C - %I
  •  %X - %Z


For more information, see String Registers

The "@" System Variables

System variables are used control certain Origin behaviors (e.g. @A controls angular units -- radians, degrees or gradians) and there is quite an extensive list of these. It is best not to begin variable names with the "@" character.


For more information, see System Variables

The LabTalk Variables and Functions Dialog Box

If you would like to check for potential variable naming conflicts, the best place to do that is in the LabTalk Variables and Functions dialog box:

  1. Select Window:Script Window from the main menu.
  2. From the Script Window menu, select Tools: Variables.

Here, you will find a list of variables and functions by category. To check whether a variable is in use, look to see whether there is a Value listed for it.

Related Quick Help Topics


Keywords:programming, variables, system variables, string registers, Set Column Values

 

© OriginLab Corporation. All rights reserved.