Compose-1000: Authoring OML in Compose

This tutorial explains how to:
  • Edit, execute, and save files.
  • Plot and manage screen space.
  • Use the Project Browser to manage files and save the project.
  • Make our own OML script.

Launch Compose

From the Start menu, click All Programs > Altair 2020.1 > Compose 2020.1.
This launches Compose in the GUI mode. Notice that by default, a file named Untitled1.oml exists in the Editor window. By default, the Authoring Mode is displayed as well.

Enter and Execute a Command

Enter a command into the OML Command Window window and execute a command from Command History window.
  1. In the OML Command Window window, type the following command:
    disp('This is a tutorial')
  2. Press ENTER on the keyboard.
    This command results in This is a tutorial being displayed in the OML Command window.

    In the Command History window, there is now a reference to the command that was just entered. This reference includes the date the command was entered along with the command itself.

Drag a Command from the Command History Window into the Editor Window

  1. In the Command History Command Window, left-click on the command to highlight it.
  2. Using the left mouse button, drag and place the command into the Editor window under the Untitled1.oml tab.
  3. Press ENTER on the keyboard to add an additional line to the script in Untitled1.oml.
  4. Click Run File (Start) to execute the commands in Untitled1.oml.
    Notice how the output is displayed to the OML Command Window.

Open and Run a File

Open a file from the File menu and execute the file.
  1. From File menu, click Open File, or use the Open File icon,
  2. From the Open File dialog, browse to the following folder location: <installation_dir>/tutorials/.

    Select the file simple_demo.oml and click Open.

    This opens a new tab in the Editor window titled simple_demo.oml. This tab is now the active tab, indicating that this file is the active file.

  3. Click Run File, , to execute the file simple_demo.oml.
    After the script is run, results are displayed in the Command Window and Plot area.
  4. Click the expand icon, , at the top right corner of the plot pane. The plot pane is lined up with the title Plots in the top left corner.

    The plot pane is expanded to cover the Editor.

  5. Click the icon again (currently collapsed) to go back to the tiled display.
  6. Similarly, expand the editor by clicking on its expand icon at the top right corner of the Editor pane. The Editor panel is lined up with the title Files.

    The editor is expanded to cover the plot.

  7. Click the icon again (currently collapsed) to go back to the tiled display.

Creating an OML Script

  1. In the Editor window, type a = 1 + 3 and press Run.

    If we type a ';' we can suppress this output.

    You’ll notice that this time, nothing is displayed in the output yet there is the variable 'a' in the Variable Browser.

  2. On the next line, type disp ('1 + 3 equals '); disp (a); and then run the script.
    This forces the output to display the value of 'a'.
  3. Press Enter and then add the following two lines to assign a matrix to 'b' :
    disp('This is a matrix')
    b = [ 1 2; 3 4]

    Without the ';' the matrix is displayed just like 'a' was. Click Run again. The following is displayed:

  4. To create a simple plot, type plot([1:10],[1:10]); and click Run.

    A linear plot is displayed.

Managing a Project

By default, the Project Browser is displayed in the left pane. This helps you manage matrices, plots, and projects.

  1. Close all plots and files opened previously.
  2. Right-click Files > Add Existing File and navigate to simple_demo.oml. The simple_demo.oml file is added to the Project Browser.
  3. Double-click the OML script to open it in the Editor.
  4. Run the file as previously outlined and you’ll notice that the plot Figure 1 was added to the Plots.
  5. To add the Matrix Editors, navigate to View > Variable Browser and double-click the matrix variable b that we defined earlier. Notice now that b is added the Matrix Editors and can be modified by the matrix editor tile.