| "John W. Eaton" wrote:
| > On 2-Aug-2000, Ben Sapp <[hidden email]> wrote:
| > 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
| But making
| x = load ("some-odd-file-name.dat")
| can be confusing; one could think that it is a general sintax. Instead,
| why not use the standard sintax,
load ("file", "option-1", "option-2");
is entirely equivalent to
load file option-1 option-2
and works for all functions that can be invoked this way (i.e., ls,
type, who, and so on).
| - Command: load options file v1 v2 ...
| Load the named variables from the file FILE.
| using v1 as the name of the variable to load to?
Because I would think that it means load only the variables named v1,
v2, etc. from the file?
| To compile I had to use the '-fpermissive' option to gcc. Even so:
| load-save.cc: In function `class octave_value_list do_load(istream &,
| const string &, bool, load_save_format, oct_mach_info::float_format,
| bool, bool, bool, bool, const string_vector &, int, int, int)':
| load-save.cc:3067: warning: assignment to `char *' from `const char *'
| discards qualifiers
Probably you should pay attention to such warnings. I haven't checked
your code, but discarding const is probably not what you really want
> | "John W. Eaton" wrote:
> | >
> | > On 2-Aug-2000, Ben Sapp <[hidden email]> wrote:
> | >
> | ...
> | > 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
Another try. Please check the docs wording.
PS-sorry, the enclosed patch also contains my structures/lists save/load
- Command: load options file v1 v2 ...
`load("option_1",..., "file", "v1", "v2" ,...)'
[..., num] = load ...'
If using the third syntax of `load', the specified return variables
will be used to hold the loaded values. Variables will be loaded
in order until the return list is exausted. NUM hold the number of
sucessefully loaded variables.
[a, b, c, num] = load("foo.dat", "x1", "y", "x3")
gives, if "foo.dat" has variables X1, X2, X3 with values
a = 1
b = (0x0)
c = 3
num = 2
Wildcarding the argument variables overwrites the corresponding
output variable, e.g. `[a, b, c, num] = load("foo.dat", "x*")'
will return only variable A with the last X* variable found, but
NUM will report that 3 variables has been loaded.