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

Home » Public Forums » archive » Re: the dimension of array
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
Re: the dimension of array [message #27302] Tue, 16 October 2001 20:30
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
From: "jiali" <jiali3@21cn.com>
> Hi, I ofter use the following operation:
> a=fltarr(10,10,10) is a 3-d array,
> if I set
> b=a(0,*,*), it is still a 3-d array. But I hope b is a 2-d
> array. How can I do then?

Use REFORM. From the documentation:

"The REFORM function changes the dimensions of an array without changing the
total number of elements. If no dimensions are specified, REFORM returns a
copy of Array with all dimensions of size 1 removed..."

For example

IDL> a = fltarr(10,10,10)
IDL> b = a[0,*,*]
IDL> c = reform(b)
IDL> help, a, b, c
A FLOAT = Array[10, 10, 10]
B FLOAT = Array[1, 10, 10]
C FLOAT = Array[10, 10]

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research




--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Intersection of 2 sets--Beginner IDL question
Next Topic: Re: fit function

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

Current Time: Wed Oct 08 11:39:38 PDT 2025

Total time taken to generate the page: 0.00488 seconds