comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Linking two or more IDL programs
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Linking two or more IDL programs [message #80452] Sat, 16 June 2012 16:52 Go to next message
Baro is currently offline  Baro
Messages: 19
Registered: May 2012
Junior Member
Dear All

I have four different programs written in IDL, each program gives me one or two parameters.I want to use the out put of this programs, as an input for one single equation, in the fifth one (that i am writing). I am facing difficulty in linking this programs into one last program. Can you help please?

Cheers
Guta
RE: Linking two or more IDL programs [message #80545 is a reply to message #80452] Mon, 18 June 2012 10:56 Go to previous message
Baro is currently offline  Baro
Messages: 19
Registered: May 2012
Junior Member
Thank you very much!!!!!!!!!!!!

IT IS WORKING


Guta
Re: Linking two or more IDL programs [message #80550 is a reply to message #80452] Sun, 17 June 2012 10:22 Go to previous message
k_ghreep is currently offline  k_ghreep
Messages: 19
Registered: May 2012
Junior Member
On Sunday, June 17, 2012 1:52:36 AM UTC+2, gutewaqi wrote:
> Dear All
>
> I have four different programs written in IDL, each program gives me one or two parameters.I want to use the out put of this programs, as an input for one single equation, in the fifth one (that i am writing). I am facing difficulty in linking this programs into one last program. Can you help please?
>
> Cheers
> Guta

It is easy to do this like that

first, write a main program say XC to add two numbers a and b

a= 3. and b = 6.



the first command line result_adda=adda(a,b)
call a subroutine namely adda to calculate a+b which is written in a separate file as follows


FUNCTION adda, a,b ; in the first line write FUNCTION adda which is
; written in the first line command follow by a comma
; and the variables names separated by comma a, b
; please note that the variables a and b are the same
; characters in the first line command in the main
; program

d= a+b ; sum a and b and put the result in a new
; variable namely d

return, {d:d} ; before ending the subroutine please set the variable d
; in the following command as follows
END ; finally end subroutine

the second command line result_mult=mult(a,b)
call a subroutine namely mult to calculate a*b which is also written in a separate file as follows


FUNCTION mult, a,b ; in the first line write FUNCTION mult follow by a
; comma and the variables names separated by comma a, b
; please note that the variables a and b are the same
; characters in the second line command in the main
; program

d= a*b ; multipli a and b and put the result in a new
; variable namely d with out problem

return, {d:d} ; before ending the subroutine please set the variable d
; in the following command as follows
END ; finally write end subroutine

if you run the following main program

?????????????????????
pro xc
a=3.
b=6.

result_adda=adda(a,b) ; addation a+b
result_mult=mult(a,b) ; multiplications a*b

print, a, b, result_adda.d
print, a, b, result_mult.d

end
?????????????????????

you will get the following results
3.00000 6.00000 9.00000
3.00000 6.00000 18.0000


finally you can write the both subroutines in one as follows
FUNCTION all, a,b
d1= a+b
d2=a*b
return, {d:d, d1:d1}
END
please note that the variables d and d1 are the sum and multiply a and b respectively.
and the main program as follows
pro XC
a=3.
b=6.

result=all(a,b)
print, a, b, result.d, result.d1
end

you will get the following results
3.00000 6.00000 9.00000 18.0000

My Best Wishes
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Shear transformation with Poly_2d
Next Topic: Main program and subroutines

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:44:51 PDT 2025

Total time taken to generate the page: 0.00569 seconds