Contents Previous Next Subchapters

Including A File During Program Execution
Syntax execfile(file name)
See Also execmat , eval

Description
Compiles and executes the specified file, where file name is a character row vector. This differs from the include statement in three ways: (1) file name is any valid O-Matrix expression and can depend on information obtained during execution; (2) the file is not included for compilation and execution until the corresponding function call to execfile is executed; and (3) the file is executed regardless of whether it has been executed before.

Example
This function does not execute the specified file until the corresponding O-Matrix statement is executed, whereas the include statement includes the file at compilation time. If the file TEMP.OMS contains the text
     print i
and you enter
     clear
     for i = 1 to 3 begin
          include TEMP.OMS
     end
O-Matrix will respond
     1
     2
     3
because one copy of the print statement was compiled inside of the for loop. On the other hand, if you enter
     for i = 1 to 3 begin
          execfile("TEMP.OMS")
     end
O-Matrix will respond
     4
     4
     4
because the print statement was included three times during the for loop but executed after the for loop finished.