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

Home » Public Forums » archive » Re: how to find the size of the array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: how to find the size of the array [message #2052] Wed, 25 May 1994 08:10 Go to previous message
djackson is currently offline  djackson
Messages: 31
Registered: June 1993
Member
In article <thompson.769537570@serts.gsfc.nasa.gov>
thompson@serts.gsfc.nasa.gov (William Thompson) writes:

> vshvetsk@fourier.oac.uci.edu (Victor Shvetsky) writes:

[...]

>> is there a way to find out the size of the array from within the program?
>> For example: help, array gives you array(50,50)
>> Now, how can I get those dimensions into the variable?

[...]

> The SIZE() function returns this information. For example,
>
> IDL> SZ = SIZE(ARRAY)
> IDL> PRINT, SZ
> 2 50 50 4 2500
>
> The first element gives the total number of dimensions (zero for scalars).
> Following this are the dimensions, 50x50 in this example.

[...]

Just to add a slightly obscure trick:

If you know that ARRAY has 2 dimensions, it's easy to get the number of
columns and rows by indexing the SIZE() information, as in...

IDL> SZ = SIZE(ARRAY)
IDL> COLS = (SIZE(ARRAY))(1) ; note extra ()!
IDL> ROWS = (SIZE(ARRAY))(2)
IDL> PRINT, COLS, ROWS
50 50

Hope this helps!

-Dick

Dick Jackson djackson@ibd.nrc.ca Standard disclaimer
Institute for Biodiagnostics, National Research Council Canada
[Message index]
 
Read Message
Read Message
Previous Topic: widget library cross-platform compatibility
Next Topic: Angstrom sign

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

Current Time: Sat Oct 11 04:49:37 PDT 2025

Total time taken to generate the page: 0.08665 seconds