[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
global variables
From: |
John W. Eaton |
Subject: |
global variables |
Date: |
Mon, 9 Feb 2009 11:36:18 -0500 |
On 9-Feb-2009, Luis A. Montes wrote:
| I'm having a strange problem with global variables. Searched the list
| but nothing seems to show up. Mind you that I'm a rather sporadic user
| of octave (or Matlab, for that matter), I was just trying to import some
| Matlab scripts to Octave running under Linux (Ubuntu Hardy) when I got
| the following:
|
| octave script.m
| GNU Octave, version 3.0.0
| Copyright (C) 2007 John W. Eaton and others.
| [...]
|
| parse error near line 3 of file p10_1.m
|
| syntax error
|
| >>> global cost hr hx grid N N_2;
| ^
|
| If I split the global declaration at the caret position so that I have:
|
| global cost hr hx grid;
| global N N_2;
|
| Then the syntax error goes away. I also renamed N variables to a longer
| name thinking that they could be clashing with other "default" global
| variables, but no dice.
|
| I don't understand the problem or the solution, so I'm wondering if
| there is a less obvious problem with the second form that will cause the
| script to fail in more subtle ways.
The problem is with the use of the name "grid", which is Octave is
treated specially by the parser because it is a "command" name and may
be used like
grid on
intead of
grid ("on")
But it is a bug, because in this context, Octave should not be
recongnizing grid as a command name.
jwe