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

Home » Public Forums » archive » Re: how to preserve trailing Shallow dimensions!
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 preserve trailing Shallow dimensions! [message #61934 is a reply to message #61933] Thu, 14 August 2008 06:28 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Aug 14, 6:33 am, vino <astrocr...@gmail.com> wrote:
> Hello Everyone,
> I was wondering whether there is any way i can preserve a trailing
> shallow dimension in array?
>
> eg:
> IDL> ab=make_array(2,1,1)
> IDL> print,size(ab,/dimensions)
>            2
> How can i make it preserve it as 2 1 1?
>
> Thanks and regards,
> Vino

Perhaps you should tell us why... The answer may be different than
you expect...

So, anyways, the trailing dims are "still there" as 1's:

IDL> f = findgen(3,1,1)
IDL> help, f
F FLOAT = Array[3]
IDL> help, f[*,0]
<Expression> FLOAT = Array[3]
IDL> help, f[*,0,0]
<Expression> FLOAT = Array[3]
IDL> print, f
0.000000 1.00000 2.00000
IDL> print, f[*,*]
0.000000 1.00000 2.00000
IDL> print, f[*,0]
0.000000 1.00000 2.00000
IDL> print, f[*,0,0]
0.000000 1.00000 2.00000
IDL> print, f[*,*,*]
0.000000 1.00000 2.00000

If you are worried about the SIZE function:
IDL> fsize = size(f,/dimensions)
IDL> nx = fsize[0]
IDL> if n_elements(fsize) gt 1 then ny = fsize[1] else ny = 1L
IDL> if n_elements(fsize) gt 2 then nz = fsize[2] else nz = 1L
etc...
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: LaTex?
Next Topic: A question about map projection

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

Current Time: Sat Oct 11 06:04:26 PDT 2025

Total time taken to generate the page: 0.24432 seconds