Contents Previous Next Subchapters

Implicit Inclusion of Commands or Functions from a File
Syntax name
See Also include , mlmode_mode

If there is no variable or function currently in scope that corresponds to the identifier specified by name, O-Matrix will search the current directory for a file with the corresponding file name . If such a file is found, it is put at the top of the current input stream and the first statement of the file is then executed. This statement is expected to define the value for name where it is used. If the statement does not define such a value, novalue is used for name.

File Name
In O-Matrix mode, the file name.oms is searched for. In Mlmode , the file name.m is searched for.

In the following example, we ensure that the entire file is executed immediately because it consists of a single block statement. If the file temp.oms in the current directory consists of the following text
          x    = seq(3)
          temp = x * x'
and you enter
     print temp
O-Matrix will respond
     [ 1 , 2 , 3 ]
     [ 2 , 4 , 6 ]
     [ 3 , 6 , 9 ]
In addition, a message informing you of the automatic include of the file temp.oms is printed in the Debugger window.

If the corresponding file name is not found in the current directory, the directories in the current path are searched in order for an occurrence of the file. (Note that the search path is different in Mlmode .)

In Mlmode, the syntax omatrix file name can be used to execute the corresponding file in O-Matrix mode. This syntax is described in more detail in the File Name heading of the Switching Between Mlmode And O-Matrix Mode section.

The include command differs from the automatic includes described here in that the search path is searched before the current directory for include commands. Thus the include command should be used by library files that want to reference another file in the library and not in the current working directory.