Re: simple .sav doesn't work [message #63886] |
Fri, 21 November 2008 09:00  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Nov 21, 10:12 am, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> loebasboy schrieb:
>
>
>
>> On 21 nov, 16:22, loebasboy <stijn....@gmail.com> wrote:
>>> Hello,
>
>>> at first I wanted to try out the command line arguments of the idl
>>> virtual machine in combination with a simple summation program, just
>>> to test it out...
>
>>> PRO test_sav
>
>>> cla = command_line_args(count = count)
>>> a = cla[0]
>>> b = cla[1]
>
>>> c = a + b
>>> header = string(c)
>>> file = filepath('test.txt', root_dir='d:')
>>> OpenW, lun3, file, /Get_Lun
>>> PrintF, lun3, header
>>> Free_Lun, lun3
>
>>> END
>
>> Sorry for the half message but I hit tab and space too soon.
>> To conclude, I thought the problem was with command line arguments but
>> when I replaced a and b with simple numbers instead of the cla
>> arguments and executed the .sav with virtual machine nothing happend.
>> If I run the program in idl with compile and run, it does what is
>> supposed to do. What am I doing wrong here? Sorry if this is a very
>> stupid question, but it is the end of the week and I'm out of
>> options ;)
>
>> thanks in advance
>
> command line args don't work with vm mode (at least I think it doesn't)
> you have to think on a different way to get your data into the routine
>
> e.g.
> env vars
> an ini file can be used to build an _extra structure
> ( http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dba...)
> a gui
>
> cheers
> Reimar
command line args should work in the vm (at least I think it does ;^)
Of course, you can't just pass the arguments, you have to use -args
when you call idl:
idl -vm=test_sav.sav -args 5 6
Remember, also, that the args are passed as a string array(!), so your
code will fail there, too. Perhaps:
PRO test_sav
;; this might help you debug it, too:
catch, theError
if theError ne 0 then begin
catch, /CANCEL
void = error_message()
return, 0
endif
cla = command_line_args(count = count)
a = FIX(cla[0])
b = FIX(cla[1])
c = a + b
header = string(c)
file = filepath('test.txt', root_dir='d:')
OpenW, lun3, file, /Get_Lun
PrintF, lun3, header
Free_Lun, lun3
END
|
|
|
Re: simple .sav doesn't work [message #63887 is a reply to message #63886] |
Fri, 21 November 2008 08:59   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On Nov 21, 8:22 am, loebasboy <stijn....@gmail.com> wrote:
> Hello,
>
> at first I wanted to try out the command line arguments of the idl
> virtual machine in combination with a simple summation program, just
> to test it out...
>
> PRO test_sav
>
> cla = command_line_args(count = count)
> a = cla[0]
> b = cla[1]
>
> c = a + b
> header = string(c)
> file = filepath('test.txt', root_dir='d:')
> OpenW, lun3, file, /Get_Lun
> PrintF, lun3, header
> Free_Lun, lun3
>
> END
This program (only modified to make ROOT_DIR point to something
reasonable for me), works for me:
IDL> .compile test_sav
% Compiled module: TEST_SAV.
IDL> save, /routines, filename='test_sav.sav'
IDL> exit
Desktop$ idl -vm=test_sav.sav -args 1 2
% Program caused arithmetic error: Floating illegal operand
Desktop$ cat test.txt
12
Mike
--
www.michaelgalloy.com
Tech-X Corporation
Associate Research Scientist
|
|
|
|
Re: simple .sav doesn't work [message #63892 is a reply to message #63888] |
Fri, 21 November 2008 08:12   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
loebasboy schrieb:
> On 21 nov, 16:22, loebasboy <stijn....@gmail.com> wrote:
>> Hello,
>>
>> at first I wanted to try out the command line arguments of the idl
>> virtual machine in combination with a simple summation program, just
>> to test it out...
>>
>> PRO test_sav
>>
>> cla = command_line_args(count = count)
>> a = cla[0]
>> b = cla[1]
>>
>> c = a + b
>> header = string(c)
>> file = filepath('test.txt', root_dir='d:')
>> OpenW, lun3, file, /Get_Lun
>> PrintF, lun3, header
>> Free_Lun, lun3
>>
>> END
>
> Sorry for the half message but I hit tab and space too soon.
> To conclude, I thought the problem was with command line arguments but
> when I replaced a and b with simple numbers instead of the cla
> arguments and executed the .sav with virtual machine nothing happend.
> If I run the program in idl with compile and run, it does what is
> supposed to do. What am I doing wrong here? Sorry if this is a very
> stupid question, but it is the end of the week and I'm out of
> options ;)
>
> thanks in advance
command line args don't work with vm mode (at least I think it doesn't)
you have to think on a different way to get your data into the routine
e.g.
env vars
an ini file can be used to build an _extra structure
( http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dbase/read_ini_dbase.pro.html)
a gui
cheers
Reimar
|
|
|
Re: simple .sav doesn't work [message #63900 is a reply to message #63892] |
Fri, 21 November 2008 07:26   |
loebasboy
Messages: 26 Registered: August 2008
|
Junior Member |
|
|
On 21 nov, 16:22, loebasboy <stijn....@gmail.com> wrote:
> Hello,
>
> at first I wanted to try out the command line arguments of the idl
> virtual machine in combination with a simple summation program, just
> to test it out...
>
> PRO test_sav
>
> cla = command_line_args(count = count)
> a = cla[0]
> b = cla[1]
>
> c = a + b
> header = string(c)
> file = filepath('test.txt', root_dir='d:')
> OpenW, lun3, file, /Get_Lun
> PrintF, lun3, header
> Free_Lun, lun3
>
> END
Sorry for the half message but I hit tab and space too soon.
To conclude, I thought the problem was with command line arguments but
when I replaced a and b with simple numbers instead of the cla
arguments and executed the .sav with virtual machine nothing happend.
If I run the program in idl with compile and run, it does what is
supposed to do. What am I doing wrong here? Sorry if this is a very
stupid question, but it is the end of the week and I'm out of
options ;)
thanks in advance
|
|
|
|
Re: simple .sav doesn't work [message #64003 is a reply to message #63968] |
Tue, 25 November 2008 01:37  |
loebasboy
Messages: 26 Registered: August 2008
|
Junior Member |
|
|
On 21 nov, 22:26, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> thanks seems I have ignored this feature. :)
>
> cheers
> Reimar
thanks for the answers people!
looking back at it, the problem was that I had build the program with
IDL+ENVI, and that doesn't work with IDL VM apparantly :s
too bad
|
|
|