comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: scalar system variable as single element array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: scalar system variable as single element array [message #80172 is a reply to message #80166] Sun, 13 May 2012 16:58 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 13 mai, 22:00, fawltylangu...@gmail.com wrote:
> Hi guys,
>
> the IDL help says that a scalar can be considered a single element array. So why is the following expression failing?
>
> IDL> help, !pi[0]
> % Expression must be an array in this context: !PI.
> % Execution halted at: $MAIN$
>
> Is it a bug or feature :-)
>
> regards,
> Lajos
>
>

Because, in IDL, as far as I know, scalar and array are two different
things!
!pi is not an array, but [!pi] is. If a scalar could be considered as
a single element array, the IDL implicit dimension rule would fail:
IDL> help,indgen(10) + !pi
<Expression> FLOAT = Array[10]
IDL> help,indgen(10) + [!pi]
<Expression> FLOAT = Array[1]
Conversely, a single element array cannot be considered as a scalar,
unless you explicitely address it:
IDL> help,indgen(10) + ([!pi])[0]
<Expression> FLOAT = Array[10]
Cheers,
alx.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: cgplot and the disappearing white axis
Next Topic: Re: Cost of student version of IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 08:42:08 PDT 2025

Total time taken to generate the page: 0.39992 seconds