SOURCE Execute an Arbitrary File

Section: FreeMat Functions

Usage

The source function executes the contents of the given filename one line at a time (as if it had been typed at the --> prompt). The source function syntax is
  source(filename)

where filename is a string containing the name of the file to process.

Example

First, we write some commands to a file (note that it does not end in the usual .m extension):
--> fp = fopen('source_test','w');
--> fprintf(fp,'a = 32;\n');
--> fprintf(fp,'b = a;\n');
--> fclose(fp);

Now we source the resulting file.

--> clear all
--> source source_test
--> who
  Variable Name      Type   Flags             Size
              a     int32                    [1 1]
              b     int32                    [1 1]