help-octave
[Top][All Lists]
Advanced

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

RE: Strange?


From: Richardson, Anthony
Subject: RE: Strange?
Date: Tue, 10 Mar 2020 13:36:06 +0000

It sounds as if you want to use exist("A") instead of isvarname("A").

Tony

> -----Original Message-----
> From: Help-octave <help-octave-
> bounces+richardson=address@hidden> On Behalf Of
> address@hidden
> Sent: Tuesday, March 10, 2020 7:22 AM
> To: address@hidden
> Subject: AW: Strange?
> 
> Hello,
> first of all: many thanks to all commenters - and you were fully right (and I
> was fully wrong :-))
> 
> A="B";
> isvarname (A)
> ans = 1
> 
> because the value of "A" (which is "B" in this case) is a valid variable name.
> So, A=1; isvarname(A) returns isvarname(1) and therefore 0 because "1"
> cannot be the name of a variable.
> 
> So, I understood it now :-). One thing that I had misunderstood was that I
> had had thought isvarname would check if "A" is actually the name of a
> variable. However, I understand now this is only a test whether or not it is
> basically possible to use it as the name of a variable.
> 
> Take care, thank you for a great program
> 
> 
> Dieter
> 
> 
> 
> 
> -----Original-Nachricht-----
> Betreff: Re: Strange?
> Datum: 2020-03-10T12:58:33+0100
> Von: "Sergei Steshenko via Help-octave" <address@hidden>
> An: "address@hidden" <address@hidden>
> 
> 
> On 10/03/2020 10:47, Ian McCallion wrote:
> > On Tue, 10 Mar 2020 at 08:22, address@hidden
> > <address@hidden> wrote:
> >> Dear listmembers,
> >> I am currently trying to go through the documentation - it's
> >> something like 1000 pages, so this takes time :-). I am using octave
> >> 5.2.0. When I say
> >>
> >>>> A=5;
> >>>> A
> >> A =  5
> >>>> isvarname (A)
> >> ans  =  0
> >>
> >> shouldn't this be "1" rather than "0"? The manual states "Return true if
> name is a valid variable name". In my example I consider "A" a valid variable
> name, isn't it? So, could you shed some light on what I am doing wrong here?
> > you need to say:
> >
> >     isvarname('a')
> >
> > Cheers... Ian
> >
> >
> Most likely  isvarname('A') - IIRC Octave is case-sensitive.
> 
> --Sergei.
> 
> 
> 
> 
> 


reply via email to

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