Re: Defining IDL structures given variable type, width and precision [message #54061] |
Thu, 17 May 2007 07:07 |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On May 16, 10:24 pm, David Fanning <n...@dfanning.com> wrote:
> Jonathan Greenberg writes:
>> Is there a trick to defining an IDL structure with the appropriate
>> variable types given that type, width and precision of each variable?
>> I am extracting data from a .dbf file, then using the envi_write_dbf
>> command to basically copy the dbf file, but I'm running into problems
>> with a string field in the original DBF that appears to be longer than
>> simply assigning that field during the create_struct portion to be '',
>> e.g.
>
>> structure=create_struct(structurename:'') <- how would I assign that
>> if I know the type is "7" (string), width=43, precision=0
>
> Strings in IDL can be any "width", so this must be a .dbf file
> requirement. It is probably better to save the string as
> a byte array, in this case, and convert to and from a string as
> needed.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
or maybe structure =
create_struct(stucturename:string(bytarr(43)+byte(32))) ? (for
example, If you want just spaces)
|
|
|
Re: Defining IDL structures given variable type, width and precision [message #54073 is a reply to message #54061] |
Wed, 16 May 2007 20:24  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jonathan Greenberg writes:
> Is there a trick to defining an IDL structure with the appropriate
> variable types given that type, width and precision of each variable?
> I am extracting data from a .dbf file, then using the envi_write_dbf
> command to basically copy the dbf file, but I'm running into problems
> with a string field in the original DBF that appears to be longer than
> simply assigning that field during the create_struct portion to be '',
> e.g.
>
> structure=create_struct(structurename:'') <- how would I assign that
> if I know the type is "7" (string), width=43, precision=0
Strings in IDL can be any "width", so this must be a .dbf file
requirement. It is probably better to save the string as
a byte array, in this case, and convert to and from a string as
needed.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|