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

Home » Public Forums » archive » Re: "shrink" structures
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: "shrink" structures [message #69765 is a reply to message #69723] Mon, 08 February 2010 05:36 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
David gave a nice solution to this question but I have a couple of
additional comments:

On Feb 8, 5:00 am, Johannes Korn <k...@freisingnet.de> wrote:
>
> I would like to "shrink" d to contain only a specific date.
>
> Something like
> ind=where(d.date eq '10052000')
> d = d[ind]
>

This would work if you had an array of structures, but not if each tag
is an array. I made the same mistake a couple of weeks ago, when I
had a large structure and was trying to save memory by subscripting to
the values I needed. Instead I found my machine crawling to a
halt because the line "d = d[ind]" will actually duplicate the
structure by the number of values in 'ind', gobbling up all my
remaining memory.


> This doesn't work of course but I thought at least d.date = d.date[ind]
> should. But this doesn't resize d.date but only fills all locations with
> the values of d.date[ind].
>

You cannot change the data type or dimensions of a structure tag.
That is why David's solution involves creating a whole new
structure. (You might want to TEMPORARY() the original structure if
your purpose is to save memory.)

But my main problem is with READ_ASCII. The case of reading
values into a structure where every tag has the same dimension size
really cries out for the use of a structure array (where each element
of the structure array corresponds to a "row" of the original ASCII
data). I can't think of any drawbacks to this (but I wouldn't be
surprised if someone proves me wrong), and it would make things like
subscripting the structure much, much easier.

--Wayne
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: File Delete -- Friggin A!!
Next Topic: Re: Simultaneous write on textfile over NFS

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

Current Time: Sat Oct 11 00:45:06 PDT 2025

Total time taken to generate the page: 2.40215 seconds