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

Home » Public Forums » archive » Re: Absurd Indexes
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: Absurd Indexes [message #9373 is a reply to message #9371] Wed, 18 June 1997 00:00 Go to previous messageGo to previous message
wonko is currently offline  wonko
Messages: 22
Registered: March 1997
Junior Member
iruiz@astro.rug.nl (Inigo Garcia) wrote:

> a=findgen(4,1000)
> b=fltarr(2,*)

You mean b=a(2,*) ?

> the array I get is an [1,1000] array, and I want an [1000] array !!!
> Does someone know any way of getting rid off that "1" dimension.
> (OK, I know the "for" loop method, but, there's no other method to do
> it ?)

Hmmm....... I wonder what this "for loop" method is.
The solution for your problem is using reform: b = reform( a(2,*) )

This is often annoying, but sometimes I find it useful to have arrays
like yours, eg. when dealing with 2d images. When an image has only one
plane (z dimension), I can still access it as image(x,y,z) with z eq 0.
I sometimes use reform to add even more dimensions, like
b=reform( a(2,*), 1, 1000, 1, 1 ).

But I noticed IDL behaves different. I don't have it here at home (BTW,
anyone got it to work under OS/2 Warp4 yet?), but I think b=a(*,2) would
give you an 1d array.


Alex
--
Alex Schuster Wonko@weird.cologne.de
alex@pet.mpin-koeln.mpg.de
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL UNIX->PC code compatability
Next Topic: Smooth scrolling zoom in draw widget; how?

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

Current Time: Wed Oct 08 19:25:21 PDT 2025

Total time taken to generate the page: 0.00194 seconds