Find all user-defined structure definitions [message #85391] |
Tue, 30 July 2013 07:03  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
I realize that one can find all the structure definitions using help:
HELP, /STRUCTURES
However, I get 469 element string array out (with the output keyword) after a .reset_session. I then have to search through for my structure. This looks ugly to me.
Is there an easier way to know if a structure has been defined already?
If I use Tag_Names() or N_Tags(), I get an error if it has not been defined.
So far my solution looks like:
Help, /Structures, Output=HelpOut
Index=Where(StrPos(HelpOut,'MYSTRUCTURE') GE 0, Count)
IF Count EQ 0 THEN print, 'create structure'
Regards,
Helder
|
|
|
Re: Find all user-defined structure definitions [message #85393 is a reply to message #85391] |
Tue, 30 July 2013 07:08  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Helder writes:
> I realize that one can find all the structure definitions using help:
>
> HELP, /STRUCTURES
>
> However, I get 469 element string array out (with the output keyword) after a .reset_session. I then have to search through for my structure. This looks ugly to me.
>
> Is there an easier way to know if a structure has been defined already?
> If I use Tag_Names() or N_Tags(), I get an error if it has not been defined.
>
> So far my solution looks like:
>
> Help, /Structures, Output=HelpOut
> Index=Where(StrPos(HelpOut,'MYSTRUCTURE') GE 0, Count)
> IF Count EQ 0 THEN print, 'create structure'
Why do you care if your structure has been defined already?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|