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

Home » Public Forums » archive » indexing bug?
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
indexing bug? [message #92892] Thu, 17 March 2016 22:57 Go to next message
Dae-Kyu Shin is currently offline  Dae-Kyu Shin
Messages: 25
Registered: February 2015
Junior Member
Hi

for example

arr = indgen(3)

;; in this case, of course error occuring
print, arr[5]

;; but in this case, there is no error
print, arr[[5]]

is this bug??

Thanks
Re: indexing bug? [message #92893 is a reply to message #92892] Thu, 17 March 2016 23:01 Go to previous messageGo to next message
Dae-Kyu Shin is currently offline  Dae-Kyu Shin
Messages: 25
Registered: February 2015
Junior Member
2016년 3월 18일 금요일 오후 2시 57분 28초 UTC+9, Dae-Kyu Shin 님의 말:
> Hi
>
> for example
>
> arr = indgen(3)
>
> ;; in this case, of course error occuring
> print, arr[5]
>
> ;; but in this case, there is no error
> print, arr[[5]]
>
> is this bug??
>
> Thanks


and in this case

print, arr[[-1]]

->> result = 0
this result is not coincide my expectation.
my expectation is : print, arr[-1]

IDL 8.5.1
Re: indexing bug? [message #92894 is a reply to message #92892] Fri, 18 March 2016 00:49 Go to previous messageGo to next message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Friday, March 18, 2016 at 6:57:28 AM UTC+1, Dae-Kyu Shin wrote:
> Hi
>
> for example
>
> arr = indgen(3)
>
> ;; in this case, of course error occuring
> print, arr[5]
>
> ;; but in this case, there is no error
> print, arr[[5]]
>
> is this bug??

No, it's a feature :-) Array subscripts are clipped, unless STRICTARRSUBS is used:

http://www.exelisvis.com/docs/using_arrays_as_array_su.html

regards,
Lajos
Re: indexing bug? [message #92895 is a reply to message #92894] Fri, 18 March 2016 01:01 Go to previous message
Dae-Kyu Shin is currently offline  Dae-Kyu Shin
Messages: 25
Registered: February 2015
Junior Member
2016년 3월 18일 금요일 오후 4시 49분 17초 UTC+9, fawltyl...@gmail.com 님의 말:
> On Friday, March 18, 2016 at 6:57:28 AM UTC+1, Dae-Kyu Shin wrote:
>> Hi
>>
>> for example
>>
>> arr = indgen(3)
>>
>> ;; in this case, of course error occuring
>> print, arr[5]
>>
>> ;; but in this case, there is no error
>> print, arr[[5]]
>>
>> is this bug??
>
> No, it's a feature :-) Array subscripts are clipped, unless STRICTARRSUBS is used:
>
> http://www.exelisvis.com/docs/using_arrays_as_array_su.html
>
> regards,
> Lajos

Good. Thanks Lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Plot function failing!
Next Topic: Take values from several arrays with nearest neighbour matching

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

Current Time: Wed Oct 08 15:26:45 PDT 2025

Total time taken to generate the page: 0.00496 seconds