help-octave
[Top][All Lists]
Advanced

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

[Attn: patch] Re: Load a file with name specified by a string?


From: David Bateman
Subject: [Attn: patch] Re: Load a file with name specified by a string?
Date: Wed, 28 Apr 2004 10:48:12 +0200
User-agent: Mutt/1.4.1i

According to Eacheon <address@hidden> (on 04/28/04):
> Ok, I find in this list that
> 
> >load(filename, 'var1','var2',...)
> 
> should work. But I need to do something like
> 
> >load -force filename var1 var2 ...
> 
> Are there any method can avoid using sprint and eval?

Why do you need to do the second method if the first works? Also the
'-force' option isn't needed in the latest version of Octave for 
reasons of compatibility. Here is my example code that works perfectly

file = 'test.mat';
a = rand(3,3);
if exist('OCTAVE_VERSION')
  save('-mat-binary',file,'a');
else
  save('-mat',file,'a');
end
clear a;
if exist(file, 'file')
  load(file,'a');
end

Note that octave can't save in matlab ascii format (though it can read
it) and you must use a binary format if you really want to use a matlab
format, to save to...

I suppose that '-mat' should be made a synonym for '-mat-binary' though
to get rid of the two different version of the save command above. If
you are really interested in this, then I attach a patch against the
current octave CVS with this change plus a couple of minor documentation
fixes.

Regards
David

-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Attachment: patch.load-save
Description: Text document


reply via email to

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