Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

User Variables

DIAdem 2011 Help

Edition Date: July 2011

Part Number: 370859J-01

»View Product Info

Use user variables to include your own variables in DIAdem. You can adapt user variables to your task by using the name, type, dimension, and values range. You must define and activate user variables before you can use them.

Define user variables in a text file with the extension .vas. Activate user variables by clicking Edit»Enable User Variables or by executing the UserVarCompile command.

Note  Do not use user variables as loop variables in scripts.
Note  Use the Dim statement to declare VBS variables and to reserve memory space for these variables. Use the GlobalDim command to define global variables. You also can define global variables in user command files. Declare the variable in the global range outside a function and register this user command file.

You define each user variable in a separate line of the text file. The lines must not have more than 255 characters. Enclose comments in curly brackets. To define user variables use the following syntax:

Name : Type READONLY [Dim1][Dim2] (Value range) <Initialization>

When you define a user variable, always specify the name and type. The other parameters are optional. The parameters have the following meanings:

  • Name: Specifies the name of the user variable. The name can have up to 16 characters and may not include any special characters. Always use an underscore (_) as the last character in the name.

  • Type: Specifies the type of the user variables. Only specify the first letter of the type. The following letters and types are valid: R for a real variable, I for an integer variable, B for a boolean variable, H for an half/byte variable, W for a Word variable, L for a LongInteger variable, F for a string variable, G for a dynamic enumeration list variable, and A for an enumeration variable. String variables that you defined in user variables definition files cannot have more than 255 characters.

  • READONLY: Specifies a constant. You cannot modify the value of a constant.

  • Dim1, Dim2: Specifies the dimension of the user variable. Enter Dim1 for vectors and Dim1 and Dim2 for matrices. Use only numbers or constants for the dimensions. Enclose the dimensions in brackets.

  • Value range: Specifies the value range for the user variables. If you define user variables as numeric types, use the following syntax: (Min, Max). If you define user variables as free text, use the following syntax: (Text length). If you do not specify a text length, DIAdem makes the maximum text length. If you define user variables as enumeration, use the following syntax: (Element1, Element2, ...). Specify the individual elements in quotation marks and enclose the value range in parentheses.

  • Initialization: Specifies the default value for the user variable. The value must be the same type as the variable and must be within the value range. Enclose the initialization value in < >. Use quotation marks when you define free text or enumeration variables. When you define dynamic enumeration lists, you must specify the name of the text file with the keywords.

Note  For column by column access to a dynamic enumeration list file in which text is separated by commas, you must enter the column number. For example, if you enter <test:3>, DIAdem reads the third column in the test file. If you enter the column number 0, DIAdem reads all the lines.

Examples

In the following example, you define an integer variable and give it the default value 4: You cannot modify the value of the variable.

IntConst_: I Readonly <4>
textfield_F [IntConst_] (80) <'ABC'>

In the following example, you define the textfield_ vector with the length IntConst. Initialize each element in the vector with the text ABC. Each element is 80 characters long.

In the following example, you define the enumeration variable MyDays_ with the valid elements Friday, Saturday, Sunday. Initialize the variable with Saturday

MyDays_: A ('Friday', 'Saturday', 'Sunday') <'Saturday'>

In the following example, you define a real vector. The vector contains four elements, which can take values ranging from -10 to 5.5. Initialize each element with the value 1.5.

RealVektor_: R [IntConst_] (-10,5.5) <1.5>
 
Note  Refer to the page Defining and Using User Variables for an example of user variable use.

Related Topics

Procedures


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit