Include a file: Difference between revisions
Content added Content deleted
(→{{header|MATLAB}} / {{header|Octave}}: Include source files) |
(→{{header|MATLAB}} / {{header|Octave}}: fix header) |
||
Line 122: | Line 122: | ||
<lang Mathematica> Get["myfile.m"] </lang> |
<lang Mathematica> Get["myfile.m"] </lang> |
||
=={{header|Matlab}} / {{header|Octave}}== |
|||
Matlab and Octave look for functions in *.m and *.mex included in the "path". |
Matlab and Octave look for functions in *.m and *.mex included in the "path". |
||
New functions can be included, either by storing a new function in an existing path, or by extending the existing path to a new directory. When two functions have the same name, the function found first in the path takes precedence. The later is shown here: |
New functions can be included, either by storing a new function in an existing path, or by extending the existing path to a new directory. When two functions have the same name, the function found first in the path takes precedence. The later is shown here: |
||
Line 128: | Line 129: | ||
% add a new directory at the end of the path |
% add a new directory at the end of the path |
||
path(path,newdir); |
path(path,newdir); |
||
addpath(newdir,'-end'); % same as |
addpath(newdir,'-end'); % same as before |
||
% add a new directory at the beginning |
% add a new directory at the beginning |
||
addpath(newdir); |
addpath(newdir); |
||
path(newdir,path); % same as |
path(newdir,path); % same as before |
||
</lang> |
</lang> |
||
=={{header|Modula-2}}== |
=={{header|Modula-2}}== |