Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: index array...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 12 Topic 5535 of 6256
Post > Topic >>

Re: index arrays of structures

by Raghu <raghuram.narasimhan@[EMAIL PROTECTED] > Mar 17, 2008 at 01:31 PM

On Mar 17, 10:57=A0am, "R.G. Stockwell" <notha...@[EMAIL PROTECTED]
> wrote:
> "Raghu" <raghuram.narasim...@[EMAIL PROTECTED]
> wrote in message
>
>
news:3db3001e-8c15-45a8-814c-9ffc92f43df8@[EMAIL PROTECTED]
>
>
>
>
>
> > Hi,
>
> > With reference to my recent posting (IDL batch indexing), i understood
> > that i could structures. However, i haven't been able to figure out
> > one step.
>
> > Here is my code as of now:
> > ; I want to search for all the images(files) in the directory trials,
> > read them into the structure named data, and access each file within
> > the structure.
>
> > pro strcutres
> > dir1=3D'D:\trials'
> > cd,dir1
> > files=3DFILE_SEARCH('*[^\.{hdr}]', /QUOTE,count=3Dnumfiles)
> > i=3D0
> > while i lt numfiles do begin
> > named=3Dfiles(i)
> > print,named
> > data=3D{ID:'a',sizes:fltarr(2179,761)}
> > data=3Dreplicate(data,numfiles)
> > data.sizes=3Dfindgen(numfiles)
> > openr,1,named
> > readu,1,data[i].sizes
> > close,1
> > i=3Di+1
> > endwhile
> > end
>
> > ERROR message- READU: Expression must be named variable in this
> > context: <FLOAT =A0 =A0 Array[2179, 761]>.
>
> > I am getting the error here because it seems like i am not able to
> > read in the LUN 1 or named, into data[i].sizes.
>
> > Where am i going wrong ?
>
> > Raghu
>
> I'm not sure if it has been explained, but your error message
> is telling you that readu,1,data[i].sizes does now work,
> because data[i].sizes is an expression. =A0It is similar to
> readu,1,x + 4
> or
> readu, 1, abs(array)
>
> in that IDL executes the data[i].sizes almost like it was a
> function, and it returns the array you request (i.e. the 'sizes'
> field of the fourth element of the data array).
>
> Just read it directly into an array, the assign the array to the
> structure in a second line.
>
> The fact that your filename is called "named" and the error message
> says you need a "named array" is just a coincedence.
>
> ALSO, =A0look at the line:
> data.sizes=3Dfindgen(numfiles)
>
> I am not sure this is doing what you want it to do.
>
> Cheers,
> bob- Hide quoted text -
>
> - Show quoted text -

Hi,

Yea, the findgen statement is not doing anything. Initially, i thought
i'd use that to generate an array of the number of files i need. But
it assigns values to it and i don't want that. I wanted something like
an empty list.
Thanks for the explaination of the named variable. I'm clear now.

Raghu
 




 12 Posts in Topic:
index arrays of structures
Raghu <raghuram.narasi  2008-03-15 13:53:47 
Re: index arrays of structures
Vince Hradil <hradilv@  2008-03-15 14:07:08 
Re: index arrays of structures
Vince Hradil <hradilv@  2008-03-15 19:31:19 
Re: index arrays of structures
Raghu <raghuram.narasi  2008-03-15 21:04:57 
Re: index arrays of structures
Vince Hradil <hradilv@  2008-03-16 05:49:23 
Re: index arrays of structures
Raghu <raghuram.narasi  2008-03-16 12:19:00 
Re: index arrays of structures
Vince Hradil <hradilv@  2008-03-16 12:29:43 
Re: index arrays of structures
Reimar Bauer <R.Bauer@  2008-03-17 15:44:07 
Re: index arrays of structures
David Fanning <news@[E  2008-03-17 09:03:48 
Re: index arrays of structures
Raghu <raghuram.narasi  2008-03-17 09:29:55 
Re: index arrays of structures
"R.G. Stockwell"  2008-03-17 11:57:03 
Re: index arrays of structures
Raghu <raghuram.narasi  2008-03-17 13:31:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 23:34:49 CDT 2008.