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

Home » Public Forums » archive » Re: kind of bewildered
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: kind of bewildered [message #26745] Mon, 24 September 2001 08:34
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Lasse Clausen wrote:
>
> Lasse Clausen wrote:
>>
>> I have the following code:
>> IDL> .run
>> - data=['12.04','13.04','14.04']
>> - A= FLOAT(DATA[WHERE(DATA EQ FLOAT('13.04'))])
>> - print,size(FINDGEN(10.)+A)
>> - end
>> % Compiled module: $MAIN$.
>> 1 1 4 1
>>
>> Why the hack do I not get an vector of size 10?!
>
> Ok, i noticed that A is not a scalar but a array with just one entry.
> can i 'cenvert' such an one-dimensional array into a scalar?

For those of you feeling similarly overwhelmed by the subtle distinction
between scalars and 1-D unit length arrays, be consoled by the following
words of wisdom from one of RSI's ace designers:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If I were designing IDL over, there would be no scalars, just
arrays of various dimensionality. 1-element arrays would use the
IDL scalar implementation internally for efficiency, but the
user would not see this. Too bad though --- IDL already exists,
and this ship sailed long before I became involved with it...
>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

JD
Re: kind of bewildered [message #26746 is a reply to message #26745] Mon, 24 September 2001 07:58 Go to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
Lasse Clausen wrote:
> Ok, i noticed that A is not a scalar but a array with just one entry.
> can i 'cenvert' such an one-dimensional array into a scalar?

A = A[0] should do the trick.
More fancy: if n_elements(A) eq 1 then A = A[0]

Jaco
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Making draw widget areas that are bigger than the screen area
Next Topic: Re: map_set, state county borders

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

Current Time: Wed Oct 08 17:06:51 PDT 2025

Total time taken to generate the page: 0.00671 seconds