| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (3 out of 4)

Accessing the NOL API Functions

To see the declarations of the NeurOn-Line functions:

  1. Select the Help > Programmer's Interface menu choice.

    NeurOn-Line displays this workspace:


  2. Click on the subworkspace buttons to look at the declarations.

Many of the API procedures require the following arguments:

If a block has an input or output data path, the API procedure for the block requires an object of class data-path-value. Your calling procedure must create the data-path-value objects. If the argument represents an input to the block, assign the input value to the data-value attribute of the data path value. If the block has vector inputs or outputs, the block's procedure passes a vector-path-value object. If the block has data pair inputs or outputs, the block's procedure passes a data- pair object. To see the class definitions for data path value, vector path value and data pair, click the Class Definitions button. The examples below demonstrate the use of data-path-values and vector-path-value objects as inputs and outputs of typical API procedures.

For most blocks, there is a procedure like nol-execute-bpn or nol-execute-rbfn that performs the same function as executing the block in a diagram. There are also procedures to help you configure certain blocks, for example, nol-configure-data- set. For data sets and neural network blocks, there are also procedures for clearing or randomizing weights (nol-clear-data-set, nol-clear-bpn), and reading and writing block information to files (for example, nol-read-bpn-from-file and nol-write-bpn-to-file).

There are also utility routines for reading and writing arrays and matrices to files. To see these procedures, click the File Operations API button. These procedures can be used to create custom format files for saving and loading your data. The four routines are:

  1. nol-read-array(stream: class g2-stream, number-of-values: integer, destination-array: g2-array, delimiter: text)

  2. nol-write-array(stream: class g2-stream, array: g2-array, delimiter: text, comment: text)

  3. nol-read-matrix(stream: class g2-stream, x: class a-matrix, rows: integer, cols: integer, delimiter: text)

  4. nol-write-matrix(stream: class g2-stream, x: class a-matrix, delimiter: text, comment: text)

The g2-stream represents a pointer to an open file, produced by a call to g2-open- file-for-read, g2-open-file-for-write, g2-open-file-for-read-and-write, or g2-open- file-for-append. The delimiter argument, usually a comma or space, is the character that separates numbers on the same line in the file. The delimiter cannot be a carriage return or tab. The comment argument is an arbitrary text that is added to the end of each written line, separated by a semi-colon. No comment is written if this argument is the empty string ("").

| Prev | Next | Start of Chapter | End of Chapter | Contents | Index | (3 out of 4)

Copyright © 1996, Gensym Corporation, Inc.