|
Re: Where's the syntax error? No stringst that only contain numbers? [message #50207 is a reply to message #50193] |
Mon, 18 September 2006 10:02   |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
try plot, x,y,xtitle='1',ytitle='2' (single quote)
Jean
Ingo von Borstel wrote:
> Hello,
>
> when calling the plot routine, I found that I cannot use all kind of
> strings as title strings:
> Quote:
> IDL> x = [1,2,3,4,5,6]
> IDL> y = [1,2,3,4,7,8]
> IDL> plot, x,y,xtitle="x",ytitle="y"
> IDL> plot, x,y,xtitle="1",ytitle="2"
>
> plot, x,y,xtitle="1",ytitle="2"
> ^
> % Syntax error.
> IDL>
>
> I get no syntax error in the first case and one in the second. I don't
> really see why. Especially as the examples are to my eyes exactly alike.
> Are strings, that contain only figures not allowed?
> I'm using IDL 6.1
>
> Regards,
> Ingo
|
|
|
Re: Where's the syntax error? No stringst that only contain numbers? [message #50208 is a reply to message #50207] |
Mon, 18 September 2006 09:57   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ingo von Borstel writes:
> when calling the plot routine, I found that I cannot use all kind of
> strings as title strings:
> Quote:
> IDL> x = [1,2,3,4,5,6]
> IDL> y = [1,2,3,4,7,8]
> IDL> plot, x,y,xtitle="x",ytitle="y"
> IDL> plot, x,y,xtitle="1",ytitle="2"
>
> plot, x,y,xtitle="1",ytitle="2"
> ^
> % Syntax error.
> IDL>
>
> I get no syntax error in the first case and one in the second. I don't
> really see why. Especially as the examples are to my eyes exactly alike.
> Are strings, that contain only figures not allowed?
> I'm using IDL 6.1
IDL thinks you are trying to create an octal constant,
not a string. Use single quotes here and you will be
set. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Where's the syntax error? No stringst that only contain numbers? [message #50285 is a reply to message #50208] |
Tue, 19 September 2006 11:15  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Mon, 18 Sep 2006 10:57:06 -0600, David Fanning wrote:
> IDL thinks you are trying to create an octal constant,
> not a string. Use single quotes here and you will be
> set. :-)
Whoever invented the notation "n for an octal constant should be taken
out and shot, or at least go through an extreme de-tox treatment to
remove whatever substance must have been influencing them at the time.
Consider this cornucopia of consistency:
IDL> a="12
IDL> help,a
A INT = 10
IDL> a= "18
IDL> help,a
A INT = 1
IDL> a= "81
IDL> help,a
A STRING = '81'
not to mention that all those loose double-quotes really mess up
string formatting. I recommend the far more sensible:
IDL> a='12'O
possibly coupled with a stern note to ITTVIS suggesting they provide
an option to disable the former brain-dead notation.
JD
|
|
|
|