3.9.4 Last Used System Variables

Origin helps you keep track of the last used value of many objects in the project---such as the last LabTalk command issued, the last X-Function called, or the last Worksheet referenced---by automatically storing their values in string variables, and updating them appropriately as actions are carried out within the project.

To distinguish these variables from other types of string variables, a double-underscore is added to the beginning of the variable name (i.e., __REPORT$). Issue the list vs command to see those active in your current project.

Like all string variables, their names should be followed by a dollar-sign, $, when accessing them. As system variables, you should not attempt to assign a value to them (that is, treat them as READ ONLY).

The following table lists the most common variable names of this automatically-generated variety, their content type, an example of use, and a brief description of their content. Keep in mind that these variables hold most recent values and are, therefore, constantly updated.

Name Content Example Description
__FINDDEP$ Worksheet Name [Sample]FindYfromX! Most recent Find Y from X table
__FINDINDEP$ Worksheet Name [Sample]FindXfromY! Most recent Find X from Y table
__FITCURVE$ Worksheet Name [Sample]FitNLCurve! Most recent fitted data
__HEADER$ String "ExponentialBaseline.dat" Last ASCII import file header string
__LASTLTCMD$

(8.51 SR1)

Command  %A=%A of %W %N Last LabTalk command issued
__LASTMATRIX$ MatrixBook name MBook1 Last active matrixbook
__LASTOGS$ OGS file name D:\User Files Folder\Custom.ogs Last executed OGS file
__LASTWKS$ Workbook name Book1 Last workbook referenced
__NLDATA$ Column or dataset name [Book1]Sheet1!2 Non-Linear Fitter input data range
__PAINTEGPEAK$ Worksheet name [Book2]Integration_Result1! Peak Analyzer's peak-integration sheet
__PAINTEGCURVE$ Worksheet name [Book2]Integrated_Curve_Data1! Peak Analyzer's integrated curve data sheet
__PABASELINE$ Worksheet name [Book1]Sheet1! Peak Analyzer's baseline data sheet
__PASUBTRACTED$ Worksheet name [Book1]Sheet2! Peak Analyzer's subtracted curve data sheet
__PAPEAKCENTER$ Worksheet name [Book1]Sheet3! Peak Analyzer's peak-center data sheet
__PEAK$ Worksheet Name [Sample]PeakProperties! Most recent peak properties data
__REPORT$ Worksheet Name [Sample]FitNL! Last report sheet generated
__RESIDUAL$ Worksheet Name [Sample]FitNLCurve! Most recent residuals from fitting
__SUBHEADER$ String "Channel Amplitude" Last ASCII import file subheader string
__XF$ X-Function Name impASC Last X-Function called

These strings are useful for further analysis. For example, the following script assigns the location of the most recently generated fit curve to a range variable, which is then integrated to find the area under the fit curve:

// Access Column 2 of the Worksheet storing the fit data
range rd = %(__FITCURVE$)2; 
// Integrate under the fit curve
integ rd;
// Display the area under the curve 
integ.area=;