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

Home » Public Forums » archive » Why does IDL strip unary dimensions from structure elements?
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: Why does IDL strip unary dimensions from structure elements? [message #5242 is a reply to message #5240] Thu, 26 October 1995 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
Thomas A McGlynn <mcglynn@grossc.gsfc.nasa.gov> writes:

> I've been writing some IDL code which does a lot of generic
> stuff with dyamically defined structures, and I've run into
> a bug/feature that is causing some problems.

Stuff deleted, about the fact that IDL strips off trailing unary
dimensions.

We've also run into this "feature", and it's a big pain. I'm sure it's there
because somebody wanted it somewhere along the line, or thought it was a good
idea.

It appears in many places, not only when working with structures. For example

IDL> a = indgen(3,1,1) & help,a
A INT = Array(3)

or

IDL> a = reform(a,3,1,1) & help,a
A INT = Array(3, 1, 1)
IDL> a = float(a) & help,a
A FLOAT = Array(3)

or

IDL> a = reform(a,3,1,1) & help,a
A FLOAT = Array(3, 1, 1)
IDL> a = a /3 & help,a
A FLOAT = Array(3)

The only way I've come across to get around this problem is to use the SIZE
function to get the original dimensions, and then REFORM to put them back, e.g.

SZ = SIZE(A)
A = A / 3
A = REFORM(A, SZ(1:SZ(0)), /OVERWRITE)

As I said, it's a real pain.

Bill Thompson
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Is it an IDL bug or feature?
Next Topic: Re: Functions calling functions

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

Current Time: Fri Oct 10 09:57:17 PDT 2025

Total time taken to generate the page: 0.39999 seconds