Creating a HiQ Script

Complete the following steps to create and run a VI that uses a HiQ script.

  1. Select Functions»Mathematics»Formula»HiQ-Script and drag out a region to place the HiQ-Script node on the block diagram.
  2. Use the Operating or Labeling tool to enter the following script in the HiQ-script node.

    a = random({50, 50});

    graph = createGraph(a);

    createView(graph, true);

    This simple HiQ script creates a matrix of random values, plots that information on a graph, displays the matrix in HiQ, and presents the generated random values on the LabVIEW front panel.
  3. Add inputs and outputs for variables. On the block diagram, right-click the HiQ-Script node frame and select Add Output from the shortcut menu. Type a to add an output for the a variable in the HiQ-Script. By default, the HiQ-Script node includes one input and one output for the error in and error out parameters.
  4. Verify the data type of the inputs and/or outputs. In HiQ, the default data type for any new input or output is Real. Right-click the a output and select Choose Data Type»Real Matrix from the shortcut menu. You set the data type to real matrix because a is defined as a 2D array in the script.
  5. Create controls and indicators for each input and output. Right-click the a output and the error out output and select Create»Indicator from the shortcut menu. LabVIEW creates indicators for a and error out on the front panel and wires terminals to these outputs on the block diagram.
  6. On the front panel, resize the a indicator to display 10 or more matrix cells both vertically and horizontally so you can see the numbers generated by the script when you run the VI.
  7. Run the VI. LabVIEW communicates with HiQ. A new HiQ window appears, labeled graph in Notebook 1, displaying the graph. LabVIEW displays, as a matrix, the values that make up this graph in the a indicator on the front panel.

The second parameter in the createView function of the HiQ script specifies whether to pause execution of the HiQ script while the HiQ window is open. The HiQ script in Step 2 does not finish until you click the Continue button in the HiQ window to close the view.

Change the true parameter to false and run the VI to see the difference.