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

Home » Public Forums » archive » Basic Array Subscripting Question
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
Basic Array Subscripting Question [message #80304] Thu, 31 May 2012 02:38 Go to next message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
This is very basic stuff but for some reason it's leaving me stumped.

I always thought that:

array[412:413, 18:19] was equivalent to array[[412,413], [18,19]]

but the first returns a 2,2 array (which I want) whilst the second
only returns a 2 element array.

<Expression> DOUBLE = Array[2, 2]
<Expression> DOUBLE = Array[2]

Any idea what I'm doing wrong?
Re: Basic Array Subscripting Question [message #80441 is a reply to message #80304] Fri, 01 June 2012 07:58 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Thursday, May 31, 2012 11:38:59 AM UTC+2, Rob wrote:
> This is very basic stuff but for some reason it's leaving me stumped.
>
> I always thought that:
>
> array[412:413, 18:19] was equivalent to array[[412,413], [18,19]]
>
> but the first returns a 2,2 array (which I want) whilst the second
> only returns a 2 element array.
>
> <Expression> DOUBLE = Array[2, 2]
> <Expression> DOUBLE = Array[2]
>
> Any idea what I'm doing wrong?

This is documented in 'Combining Array Subscripts':

When combining two subscript arrays, each element of the first subscript array is combined with the corresponding element of the second subscript array. The two subscript arrays must have the same number of elements. The resulting subscript array has the same number of elements as its constituents. For example, the expression A[[1, 3], [5, 9]] yields the elements A[1,5] and A[3,9].

regards,
Lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Basic Array Subscripting Question
Next Topic: V8.2 compilation error, works in V8.1

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

Current Time: Fri Oct 10 11:22:34 PDT 2025

Total time taken to generate the page: 0.39753 seconds