2.8.1 Basic Matrix Book Operation

Matrixbook has the same data structure level with workbook in Origin, both are windows. So, you can manipulate matrixbooks with the Page object and Window command, which is similar to workbook.

Workbook-like Operations

Both matrixbook and workbook are windows, and they share lots of similar operations, even using the same LabTalk script. So, the differences will be pointed out below, and if the same script is used, please refer to Basic Workbook Operation.

  1. Create New Matrixbook
    When using X-Function newbook to create new matrixbook, the argument mat must be 1. Here is the similar example to the one for workbook.
    //Create a new matrixbook with the Long Name "MyMatrixBook"
    newbook mat:=1 name:=MyMatrixBook;
    // Create a new matrixbook with 3 matrixsheets
    // and use "Images" as Long Name and short name
    newbook mat:=1 name:=Images sheet:=3 option:=lsname;
    // Create a new hidden matrixbook
    // and the matrixbook name is stored in myBkName$ variable
    newbook mat:=1 hidden:=1 result:=myBkName$;
    // Output matrixbook name
    myBkName$ = ;
  2. Open Matrixbook
    Use the same command, doc -o, as opening workbook, to open matrixbook. The difference is that the extension of a matrixbook is ogm.
  3. Save Matrixbook
    Origin's matrixbook with data is with the extension of ogm, and template without data is otm. To save matrixbook to ogm file and otm file, the save -i command and template_saveas X-Function will be used respectively, that is also the same with workbook. However, matrixbook is not able to be saved as an analysis template.
  4. Close Matrixbook
    This is the same as workbook, see commands win -ca and win -cd.
  5. Show or Hide Matrixbook
    This is the same as workbook, see switches -ch, -h, and -hc in win command.
  6. Name and Label Matrixbook
    This is the same as workbook, see win -r command, and page object.
  7. Activate Matrixbook
    This is the same as workbook, see win -a command. The command window -o winName {script} can be used to run the specified script for the named matrixbook. See the opening pages of the Running Scripts chapter for a more detailed explanation.
  8. Delete Matrixbook
    This is the same as workbook, see win -c command.

Show Image Thumbnails

To show or hide image thumbnails, the command matrix -it is available.

// Create a new matrixbook
newbook mat:=1;
// Import an image
string strImg$ = system.path.program$;
strImg$ += "Samples\Image Processing and Analysis\bamboo.jpg";
impImage fname:=strImg$;

// Hide image thumbnails
matrix -it 0;