Re: Simple question on Arrays [message #29141 is a reply to message #29140] |
Mon, 04 February 2002 00:44  |
Vincent Schut
Messages: 8 Registered: February 2002
|
Junior Member |
|
|
Akhila wrote:
> HI,
> I have written a small code to get a 3D array from a 2D array. The
> error i encounter is :
>
> DL> multfile
> RESULT STRING = Array[3]
> I INT = 0
> % Out of range subscript encountered: A.
> % Execution halted at: MULTFILE 16
> D:\RSI\IDL55\Akhila\JanWeek3\multfile.pro
> % $MAIN$
>
>
>
> Can anybody please tell me, why the subscripts are out of range. i'm
> not able to understand that.
>
[snipped your program code...]
Akhila,
use N_ELEMENTS instead of SIZE.
Size returns not the number of elements in an array, but a couple of
other properties, like the number of dimensions (which is *not* the
number of elements; a (3,2) array has 6 elements, but 2 dimensions. Your
array has only 1 dimension, as it is a 1-dimensional array; and some
info about the data type of the argument of size. For more info, see
your idl-help or manual.
Using N_ELEMENTS should give you the right result: 3, as your array (as
you pick 3 files) has 3 elements.
Hope it helps.
Cheers,
Vincent Schut.
|
|
|