octave-maintainers
[Top][All Lists]
Advanced

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

Checking existance of global variable in function?


From: Volker Kuhlmann
Subject: Checking existance of global variable in function?
Date: Sun, 16 Jul 2006 20:10:21 +1200

I'm trying to check a global variable inside a function file. This
construction:

function [out] = plotinit (eps, file, gnuplotfile)
global graphdir
if (exist('graphdir') ~= 0)
    graphdir=[graphdir '']

produces
warning: implicit conversion from matrix to string
on the first access to graphdir. exist() always returns 1, caused by the
global declaration in the function file. Obviously this global
declaration can't be removed, but I don't see a way to test inside a
function whether a global variable has been set, without causing a
warning.

Is this a bug, meant to be impossible, or am I thick?

GNU Octave, version 2.1.72 (x86_64-suse-linux).

Thanks,

Volker

-- 
Volker Kuhlmann                 is list0570 with the domain in header
http://volker.dnsalias.net/     Please do not CC list postings to me.


reply via email to

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