[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assoc question



Joe Means (means@fsl.orst.edu) writes:

> I find when I assoc a structure I can reference 1 record of it 
> but not multiple records  For example, this works
> c = binData[23]
> but this does not:
> b = binData[2:5]
> 
> How can i access ranges of data with associated variables?

I don't think this can be done. At least not the way
you want it to work. You could use a second associated
variable on the same data file to get the "chunk" of
data, I suppose. But I'm not sure there are too many
advantages. Something like this...

Suppose we open the 64-by-64-by-15 abnorm.dat byte
array found in the IDL_DIR/examples/data directory. We
could do this:
  
   file = Filepath(SubDir=['examples','data'], 'abnorm.dat')
   OPENR, lun, file, /Get_Lun
   a = Assoc(lun, BytArr(64, 64))
   TV, a[4]

Now get the range a[5:8] by doing this:

   b = Assoc(lun, BytArr(64, 64, 4), 64*64*5)
   FOR j=0,3 DO TV, (b[0])[*,*,j], j

I don't know. I don't see too many applications right
off hand. :-(

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

[Note: This follow-up was e-mailed to the cited author.]