2.8.1 Basic Matrix Book Operation

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

Workbook-like Operations

Both matrix book 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 Matrix Book
    When using X-Function newbook to create new matrix book, the argument mat must be 1. Here is the similar example to the one for workbook.
    //Create a new matrix book with the Long Name "MyMatrixBook"
    newbook mat:=1 name:=MyMatrixBook;
    // Create a new matrix book with 3 matrix sheets
    // and use "Images" as Long Name and short name
    newbook mat:=1 name:=Images sheet:=3 option:=lsname;
    // Create a new hidden matrix book
    // and the matrix book name is stored in myBkName$ variable
    newbook mat:=1 hidden:=1 result:=myBkName$;
    // Output matrix book name
    myBkName$ = ;
  2. Open Matrix Book
    Use the same command, doc -o, as opening workbook, to open matrix book. The difference is that the extension of a matrix book is ogm.
  3. Save Matrix Book
    Origin's matrix book with data is with the extension of ogm, and template without data is otm. To save matrix book 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, matrix book is not able to be saved as an analysis template.
  4. Close Matrix Book
    This is the same as workbook, see commands win -ca and win -cd.
  5. Show or Hide Matrix Book
    This is the same as workbook, see switches -ch, -h, and -hc in win command.
  6. Name and Label Matrix Book
    This is the same as workbook, see win -r command, and page object.
  7. Activate Matrix Book
    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 matrix book. See the opening pages of the Running Scripts chapter for a more detailed explanation.
  8. Delete Matrix Book
    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 matrix book
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;