Home »
Public Forums »
archive »
gotcha: indexing into a scalor
gotcha: indexing into a scalor [message #7886] |
Fri, 17 January 1997 00:00 |
paul
Messages: 22 Registered: June 1991
|
Junior Member |
|
|
I am using IDL Version 3.6 (ultrix mipsel).
I've discovered an IDL "feature" that caused me a bit of grief.
try the following code segment,
x=0
i=indgen(9)
x(i)=findgen(9)
print,x
8
help,x
X INT = 8
print,x(i)
8 8 8 8 8 8 8 8 8
My error was to set x to a scalor in the first line. As you can see
that one mistake led to some rather bizarre behaviour. I had thought
IDL would issue an error message if I tried to use an index array with
a scalor. But, this example shows that scalors will accept index
arrays with no complaint. Now I realize this is part of the IDL
subscripting rule that subscript arrays are not bounds-checked before
use. What is surprising is that the rule extends to single element
arrays (scalors).
Is this feature carried over to latter versions of IDL?
--
____________________________________________________________ _______________
Paul Ricchiazzi
Institute for Computational Earth System Science (ICESS)
University of California, Santa Barbara
email: paul@icess.ucsb.edu
____________________________________________________________ _______________
|
|
|
Current Time: Wed Oct 08 19:00:10 PDT 2025
Total time taken to generate the page: 0.00567 seconds