Re: Reference Last Element of Array

From: Ian Harris <i.harris_at_nyahnyahspammersnyahnyah>
Date: Wed, 1 Jul 2009 15:37:11 +0100

Actually, it'd be quite nice for such a trick to be added. Matlab
added the keyword 'end' a few versions ago, and it's jolly useful.

Of course, NCL may be written in such a way that it would be a
nightmare to add..

Cheers

Harry

On 1 Jul 2009, at 15:31, Dennis Shea wrote:

> To my knowledge, there is no such 'trick' for subscripting.
>
> You must use 'N-1'
>
> Lunde, Bruce N CIV NAVOCEANO, NP1 wrote:
>> Hello,
>>
>> Just wanted to confirm that to reference
>> the last element of an array, there is
>> no simple trick like using "-1" for the
>> indices (e.g. last_element = myarray(-1)).
>>
>> You must always use dimsizes(myarray) and
>> pick out the appropriate element of that
>> to find the last element.
>>
>> Thanks, Bruce
>>
>>
>> ---------------------------------------------------------------------
>> ---
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Ian "Harry" Harris
Climatic Research Unit
School of Environmental Sciences
University of East Anglia
Norwich NR4 7TJ
United Kingdom

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 01 2009 - 08:37:11 MDT

This archive was generated by hypermail 2.2.0 : Thu Jul 02 2009 - 11:39:37 MDT