[Top][All Lists]

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

function scope and load

From: John W. Eaton
Subject: function scope and load
Date: Thu, 17 May 2001 13:32:31 -0500

On 17-May-2001, Adam Kornick <address@hidden> wrote:

| I'm trying to port some Matlab code that loads a file of structs and
| then returns some of the structs to the calling function.  Loading the
| file works fine from the command prompt, but when I call the function
| to load the file it returns empty variables. Examples below, not sure
| what to do next. Thoughts?
| I'm using GNU Octave, version 2.1.33 (i386-redhat-linux-gnu).
| `The function does the following
| function [const,sat,shallow]=t_getconsts;
| if exist('t_constituents.mat');
|   load -force "t_constituents.mat" %has structs inside
| else
| % do some math to generate the file
| end;

I'm not sure that this is a bug.  You are counting on the `%' symbol
on the load command line to act as a comment character.  But why
should that be (if it is treated as a comment character, it means you
can't use this syntax to load a file named "%foo").  OTOH, you can't
use this syntax to load a file named ";foo" or ",foo" either, because
";" and "," are interpreted as command separators even in this

Anyway, it is easy enough to work around.  Write

  load -force file;  % my comment here.


  load ("-force", "file");  % my comment here.


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]