From help-request at octave dot org Tue May 24 07:13:07 2005 Subject: Re: can't perform indexing operations for type From: Miquel Cabanas To: Kocsis Attila Cc: help at octave dot org Date: Tue, 24 May 2005 14:18:17 +0200 hello, On Tue, May 24, 2005 at 04:09:43AM -0700, Kocsis Attila wrote: > > I've experienced a wierd thing recently (at least > wierd for me...:). So, if I put my code into > /usr/share/octave/2.1.69/m/own_library, and run it > from there. Then no error message appeared... I > thought I could run it from whatever place (eg. my > home directory), there shouldn't be difference...Ain't > I right? the only difference arises from the fact the octave doesn't search elsewhere, hence, you have to instruct it where to find your code. Indeed, this holds true for all kind of computer programs and scripts. Check the value of DEFAULT_LOADPATH and LOADPATH in a fresh run, octave:1> DEFAULT_LOADPATH DEFAULT_LOADPATH = .:/usr/lib/octave ... octave:2> LOADPATH LOADPATH = : > Then where it is advisabe to keep the code and run? elsewhere as long as you tell octave where to find it. See below, read the on-line help for `path' and also the manual chapter about "Getting Started" for details on the several ways to set the M-files path in octave: command line options, environment variable, general and user .octaverc files, etc. > Where is the good place for written data to be kept? I > guess the closer it is to the beggining of the hard > disk the faster performance I get... unless you are really pushing your hardware to the limits you shouldn't care where your data lives. > Isn't there a library for data files in octave such as > there is the /usr/share/octave/2.1.69/m/ for .m files > (at least for those ones which are not supposed to change...)? not really sure what you mean by a "library for data files", you can place your data files wherever it pleases you, and then tell the `load' command where to find them, or change into the data directory (`cd ~/data') before loading your data files. The standard M-files are part of Octave and are kept in a common directory grouped in subdirectories. Your M-files should better be kept in its own directory, e.g. `/home//octave/m' that can be added to the search path with the command, > path("~/Octave//", "~/Matlab//", ":"; > LOADPATH LOADPATH = ~/Octave//:~/Matlab//:: note the double forward slash at the end, it tells Octave to search in all directories under the given directory. Also, note the trailing colon, it is a short notation for the DEFAULT_LOADPATH variable and ensures you can continue using all M-files available under the directories defined in DEFAULT_LOADPATH. Last, you can save this commands in `.octaverc' at your home directory so that they are executed everytime you run octave. Hope this helps, Miquel -- Miquel E Cabanas ------------------------------------------------------ SeRMN, Universitat Autonoma de Barcelona (Miquel dot Cabanas at uab dot es) ------------------------------------------o-oo--ooo---ooo--oo-o-------- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------