View Full Version : add m-files to octave
Cerny
April 4th, 2008, 11:26 PM
I need to download some m-files for my linear algebra class and i can't figure out where to place the files in order for octave to find them. If anyone knows where they would be placed that would be great.
dedmonds
April 4th, 2008, 11:56 PM
I believe you can add the directory in which the m-files are located to the search path that octave uses using the addpath command as shown below:
octave:2> addpath("/home/dedmonds/octave/mfiles/");
This will not survive through a shutdown of the program, so you would have to do this each time you start octave.
I believe you can also run the path command to see the directories currently in the octave search path. You can place your m-files in one of these directories and, octave should find them.
octave:3> path
Octave's search path contains the following directories:
.
/home/dedmonds/octave/mfiles
/usr/local/share/octave/site-m
/usr/lib/octave/3.0.0/oct/i486-pc-linux-gnu
/usr/share/octave/3.0.0/m
/usr/share/octave/3.0.0/m/deprecated
/usr/share/octave/3.0.0/m/audio
/usr/share/octave/3.0.0/m/control
/usr/share/octave/3.0.0/m/control/obsolete
/usr/share/octave/3.0.0/m/control/base
/usr/share/octave/3.0.0/m/control/hinf
/usr/share/octave/3.0.0/m/control/system
/usr/share/octave/3.0.0/m/control/util
/usr/share/octave/3.0.0/m/geometry
/usr/share/octave/3.0.0/m/elfun
/usr/share/octave/3.0.0/m/finance
/usr/share/octave/3.0.0/m/general
/usr/share/octave/3.0.0/m/linear-algebra
/usr/share/octave/3.0.0/m/image
/usr/share/octave/3.0.0/m/io
/usr/share/octave/3.0.0/m/plot
wangji
April 5th, 2008, 03:12 AM
I need to download some m-files for my linear algebra class and i can't figure out where to place the files in order for octave to find them. If anyone knows where they would be placed that would be great.
you can put whereever you want ! just do in an octave session
addpath(genpath("/path_where_you_want/";
savepath;
and all the where_you_want including subdirs behind are included
and even saved for subsequent sessions
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.