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

Home » Public Forums » archive » Re: In need of array help!
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: In need of array help! [message #61299] Fri, 11 July 2008 10:48 Go to next message
aaron.pink is currently offline  aaron.pink
Messages: 2
Registered: July 2008
Junior Member
Wow, Thank you so much paulv! I definitely appreciate the help!
Re: In need of array help! [message #61300 is a reply to message #61299] Fri, 11 July 2008 10:40 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
.Pink wrote:
> Hi folks, I'm new to IDL and I'm having a bit of trouble with array
> manipulation.
>
> I have a program that encounters data sets of varying sizes, and I
> need to store the information into an array contained in an object.
>
> I've tried using the array resizing techniques found in
> http://www.dfanning.com/code_tips/nullarray.html, but no matter what I
> to, I am unable to actually change the size!
>
> Any suggestions would be very very very helpful!
>
> Thanks,
> Aaron
> -------------
> struct = {PermResults, $
> SliceNum: 0.0, $
> roiValues: fltarr(100000), $ ;100000 is far more than I
> need, but still a terrible way to do it.
> area: 0.0, $
> perimeter: 0.0, $
> pxlcount: 0L}
> ---------------------

You should read up on the differences between named and unnamed structures. Apart from
that, two things spring to mind:

1) Pointers:

struct = {PermResults, $
SliceNum: 0.0, $
roiValues: ptr_new(/allocate_heap), $
area: 0.0, $
perimeter: 0.0, $
pxlcount: 0L}

you can then simply do

*struct.roiValues = ...data...

as required to "create" the data entry to what ever size you want.


2) Use CREATE_STRUCT() to create your structure on the fly. It can be a bit of a pita to
do that though - I've only found it useful when I do the same thing over and over again
(e.g. reading netCDF files) so that I can stick all the mucking about in a procedure. And
I don't think you can do it for named structures that you will add stuff to after
creation.... but I'm not sure.


cheers,

paulv
Re: In need of array help! [message #61368 is a reply to message #61299] Mon, 14 July 2008 08:10 Go to previous message
humanumbrella is currently offline  humanumbrella
Messages: 52
Registered: June 2008
Member
On Jul 11, 1:48 pm, ".Pink" <aaron.p...@gmail.com> wrote:
> Wow, Thank you so much paulv!  I definitely appreciate the help!

Make sure to clean up your pointers afterwards.
Also - I find it interesting that you originally posted at 1:11 on
July 11.
Lot of 1's up there.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: simple FORMAT question for the experts
Next Topic: Access array elements with String

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

Current Time: Wed Oct 08 13:59:49 PDT 2025

Total time taken to generate the page: 0.00760 seconds