help-octave
[Top][All Lists]
Advanced

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

Re: loading a filename beginning with a digit


From: Mike Miller
Subject: Re: loading a filename beginning with a digit
Date: Sun, 20 Jul 2003 22:28:52 -0500 (CDT)

On Sun, 20 Jul 2003, John W. Eaton wrote:

> Hmm.  Octave 2.1.50 creates a variables called X2x instead so that it
> will have a valid variable name.
>
> Also, with reasonably recent versions you can use
>
>   some_other_name = load ("2x.txt");


I wish I'd known about that last one.  I wanted to create a function
called "loadfile" that would allow me to do exactly that sort of thing,
but even in somewhat older versions of Octave.  The thing we were starting
on is immediately below, but I'm sure it's pretty bad.

function newmatrix = loadfile(filename)

dfi = do_fortran_indexing;
do_fortran_indexing =1;
load("-force",filename)
result = split(filename,".");
depf=default_eval_print_flag;
default_eval_print_flag=0;
newmatrix =eval(result(1,:));
do_fortran_indexing =dfi;
default_eval_print_flag=depf;
endfunction

Now I suddenly see that there is a function by Kurt Hornik called "aload"
(copyright 1997) on one of my systems, but I doesn't work for me with
Octave 2.0.14.

## Author:  KH <address@hidden>
## Description:  Load from a flat ASCII data file

function x = aload (filename, cw, rw, FS, NA, ignore_regexp)


Best,

Mike



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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