[Top][All Lists]

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

Re: load problems

From: John W. Eaton
Subject: Re: load problems
Date: Wed, 2 Aug 2000 14:00:19 -0500 (CDT)

On  2-Aug-2000, Ben Sapp <address@hidden> wrote:

| address@hidden wrote:
| > 
| > why not do this:
| > 
| > system(['cp -f ' Name1 ' tmp.wav']);
| > load -ascii tmp.wav ;
| > 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?


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]