From help-octave-request at bevo dot che dot wisc dot edu Wed Aug 2 13:59:52 2000 Subject: Re: load problems From: "John W. Eaton" To: bsapp at lanl dot gov Cc: courtois at ensia dot inra dot fr, help-octave@bevo.che.wisc.edu Date: Wed, 2 Aug 2000 14:00:19 -0500 (CDT) On 2-Aug-2000, Ben Sapp wrote: | courtois at ensia dot inra dot fr wrote: | > | > why not do this: | > | > system(['cp -f ' Name1 ' tmp.wav']); | > load -ascii tmp.wav ; | > EXTRACT YOUR DATA HERE e.g. : | > eval(['x' Name1 '=tmp;']); clear tmp; | > system('rm tmp.wav'); % Not necessary | > | > ? | | This is a good idea. I knew someone would think of a better solution | than I came up with.(a C++ dynamically linked file) However, I think I | will use ln rather than cp, because the files can be somewhat large. FWIW, Octave has unlink(), so the system command to remove the file can be done directly without having to start a shell subprocess. Perhaps it should also have link(), symlink(), and readlink(), since they would be fairly trivial to add. Also, if you are going to copy (or link) the file to some other name, why not make it the name of the variable that you want to load? Then you don't have to copy the data from a temporary name. Perhaps it is best to do this in some subdirectory. Something like mkdir ("some tmp directory"); chdir ("some tmp directory"); link (old-name, new-name); # or use system() until link is available load (new-name); unlink (new-name); chdir ("back where we started"); (Adding some error checking to this would probably also be a good idea.) Of course, Octave should probably also allow x = load ("some-odd-file-name.dat") so all of this would be unnecessary. Anyone care to implement it and submit a patch? jwe ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------