[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: octave-forge usage?

Miles Bader wrote:
Hi, thanks for the response, but I think I'm asking a slightly different
question than you answered.

I know how to use octave generally, but I want to use some of the
specialized functions which are distributed in the "octave-forge"
package in debian (actually "octave2.9-forge" I think).

When that package is installed, it puts all those functions in various
subdirectories of "/usr/share/octave/site/api-v22/m/octave2.9-forge/",
e.g., the "imread" function is in

What I don't understand is how one is generally supposed to tell octave
to load those files, so one can use the associated functions.

I _could_ just load the file manually by doing:


but that seems rather clumsy, and it looks like there's supposed to be a
more elegant and user-friendly mechanism via the octave "pkg" function.
Unfortunately, I can't get the "pkg" function to actually do anything
useful; I don't know if it's my misunderstanding or whether there's
something broken.



Octave and Matlab both deal with your issue the same way -- at least that is how I understand it. When Octave fires up or when Matlab fires up an automatic search occurs to find the m files. As I understand it, your PATH and maybe some other environmental variables need to be set so the search captures the "m" files that you want Octave to find when it fires up. All of this is in Matlab documentation and tutorials. You indicated there were certain "m" files such as "imread.m" that you were interested in using. Most probably your PATH has not been set to find these "m" files. The "m" file is just an executable (by Octave or Matlab) file and is a way of creating customized commands that are not built into Octave or Matlab. Also, you can build your own "m" files. You can run commands interactively in both Octave and Matlab and prove out your command structure before embedding this script into your own "m" file. You can modify existing "m" files. The name of the "m" file is the name of the command you created. It's something like creating an executable bash file. Bash needs to know where the file is resident. So does Octave and Matlab. I don't know if an "m" file has to be specifically set up as an executeable. In conclusion, I think your PATH has not been properly set in order for Octave to find the "m" files you want. You really should spend some time on the Matlab documentation covering this issue of accessibility of "m" files in case I have missed something. It' s also worth while if you play around a bit and create one of your own "m" files -- perhaps starting with an existing one where you make some very simple alteration and give the file a unique name and by that means explore the dependencies on the PATH and perhaps other variables you can read about in the documentation.

As far as the packaging is concerned I don't think the package is going to resolve the kind of problem you are encountering. As I previously noted there is virtually no documentation on Octave and so you probably won't find any kind of instructions regarding this problem you are having, nor will you find some script in the package which alters your PATH and sets specific variables.. I emphasize that the Matlab documentation deals directly with your current issue. It must have been a lot of talented hard work just to get Octave operating so that it could do most of what Matlab does.and uses the same syntax and language elements.

Hope all this helps.


Reply to: