|
Re: IDL Error GCPC data [message #69319 is a reply to message #69259] |
Wed, 06 January 2010 10:55  |
jeanh
Messages: 79 Registered: November 2009
|
Member |
|
|
sampton wrote:
> Hi,
> I tried this code but got a santax error for .[j] when removing the
> dot (.) I got an error about 'j':
> PrintF, lun, fields[j], ': ', struct.[j]
>
> with .j Error:
> IDL> PrintF, lun, fields[j], ': ', STRUC1979.[j]
>
> PrintF, lun, fields[j], ': ', STRUC1979.[j]
> ^
> % Syntax error.
hi,
use () instead of [] STRUC1979.(j)
Jean
|
|
|
Re: IDL Error GCPC data [message #69320 is a reply to message #69259] |
Wed, 06 January 2010 10:42  |
sampton
Messages: 8 Registered: December 2009
|
Junior Member |
|
|
Hi,
I tried this code but got a santax error for .[j] when removing the
dot (.) I got an error about 'j':
fields = Tag_Names(struct)
OpenW, lun, 'C:\cgcp\data.txt', /Get_Lun
FOR j=0,N_Elements(fields)-1 DO $
PrintF, lun, fields[j], ': ', struct.[j]
Free_Lun, lun
Error:
IDL> PrintF, lun, fields[j], ': ', struc1979[j]
% Attempt to subscript STRUC1979 with J is out of range.
% Execution halted at: $MAIN$
with .j Error:
IDL> PrintF, lun, fields[j], ': ', STRUC1979.[j]
PrintF, lun, fields[j], ': ', STRUC1979.[j]
^
% Syntax error.
On 4 jan, 21:17, David Fanning <n...@dfanning.com> wrote:
> sampton writes:
>> Thanks again for your help,
>> I'm just wondering how I can save struct to data.txt after executing
>> the command under IDL:
>> IDL> read_v2_1, 'gpcp_v2.1_psg.1979', struct
>> I want to save struct to data.txt to be oppened with text editor under
>> windows (so data.txt wil be located under a spedcific folder say: c:
>> \cgcp\data.txt).
>
> I'd try something like this:
>
> fields = Tag_Names(struct)
> OpenW, lun, 'C:\cgcp\data.txt', /Get_Lun
> FOR j=0,N_Elements(fields)-1 DO $
> PrintF, lun, fields[j], ': ', struct.[j]
> Free_Lun, lun
>
> 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.")
|
|
|
Re: IDL Error GCPC data [message #69344 is a reply to message #69259] |
Mon, 04 January 2010 18:17  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
sampton writes:
> Thanks again for your help,
> I'm just wondering how I can save struct to data.txt after executing
> the command under IDL:
> IDL> read_v2_1, 'gpcp_v2.1_psg.1979', struct
> I want to save struct to data.txt to be oppened with text editor under
> windows (so data.txt wil be located under a spedcific folder say: c:
> \cgcp\data.txt).
I'd try something like this:
fields = Tag_Names(struct)
OpenW, lun, 'C:\cgcp\data.txt', /Get_Lun
FOR j=0,N_Elements(fields)-1 DO $
PrintF, lun, fields[j], ': ', struct.[j]
Free_Lun, lun
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.")
|
|
|