Re: Singular arrays in structures... [message #39903] |
Mon, 28 June 2004 06:26 |
tam
Messages: 48 Registered: February 2000
|
Member |
|
|
Reimar Bauer wrote:
> Tom McGlynn wrote:
>
>
>> I'm sure that this probably has come up before, but I just haven't
>> noticed it but every once in a while I run regression tests...
>>
>> In IDL 5.2 if one starts with
>>
>> x = {a:intarr(1),b:0}
>> y = replicate(a,10)
>>
>> Then
>>
>> y.a = intarr(10) works
>> y.a = intarr(1,10) fails
>>
>> In IDL 5.6 the results are reversed, the second method works
>> while the first fails.
>>
>> Does anyone have any workarounds that will handle
>> both cases or has this inconsistency perhaps been fixed
>> in later versions of IDL? I'd prefer not to have to
>> refer to the IDL version explicitly in the code.
>>
>> Thanks,
>> Tom McGlynn
>
>
> Dear Tom,
>
> A workaround like this should help
>
> sz=size(y.a,/dimensions)
> y.a=reform(intarr(10),sz)
>
> regards
>
> Reimar
>
Thanks Reimar,
I think that's exactly what I need. I can probably use
the /overwrite option in the reform to make it
a little faster since I can modify the array being
assigned to the structure.
Regards,
Tom
|
|
|
Re: Singular arrays in structures... [message #39905 is a reply to message #39903] |
Fri, 25 June 2004 08:49  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Tom McGlynn wrote:
> I'm sure that this probably has come up before, but I just haven't
> noticed it but every once in a while I run regression tests...
>
> In IDL 5.2 if one starts with
>
> x = {a:intarr(1),b:0}
> y = replicate(a,10)
>
> Then
>
> y.a = intarr(10) works
> y.a = intarr(1,10) fails
>
> In IDL 5.6 the results are reversed, the second method works
> while the first fails.
>
> Does anyone have any workarounds that will handle
> both cases or has this inconsistency perhaps been fixed
> in later versions of IDL? I'd prefer not to have to
> refer to the IDL version explicitly in the code.
>
> Thanks,
> Tom McGlynn
Dear Tom,
A workaround like this should help
sz=size(y.a,/dimensions)
y.a=reform(intarr(10),sz)
regards
Reimar
--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
|
|
|