Using M-Files From Excel

mathlayer can read m-files, i.e. files containing Matlab/Octave-like syntax for scripts and functions.

mathlayer will look for m-files in each folder defined in path and in the current working directory.

As a first simple example you can copy the following code

x = [1 2; 3 4]
y = rand(2)
disp(x)
and paste it into a text file that you store for instance under C:\mathlayer\mfiles\testscript.m.

To make testscript.m visible to mathlayer you can either:
  • add C:\mathlayer\mfiles to the path
> path('C:\mathlayer\mfiles')
  • change from current working directory to C:\mathlayer\mfiles
> cd('C:\mathlayer\mfiles')
Now you can run testscript.m

> testscript

x =

            1            2
            3            4

            [x:2x2 double]
            [y:2x2 double]

Related functions

cd | path | rmpath