MATLAB Fortran alternative to Matlab 'system' command

AI Thread Summary
To execute a Linux executable from Fortran code, the use of the "system()" command is suggested, although it may differ based on the Fortran compiler. The "./" prefix indicates that the executable is in the current directory, which may not be recognized if the executable is not located there. It is recommended to specify the full path to the executable instead, such as '/mnt/hd1/usr/mushi/bin/filename'. This approach ensures that the operating system can locate the executable correctly. For further reference, resources on Fortran programming and random number generators are available online.
mushi
Messages
23
Reaction score
0
Hi,

I have been trying to run a linux executable (written in fortran77) into my another code (also in fortran77). In Matlab, I did it with "system('./<filename>')". But I am not able to do it in fortran script as './' is not simply working for me.

I will really appreciate if anyone could tell me what alternative command I can use to execute an executable file into fortran code. A quick response will be extremely helpful and highly appreacited.

Thanks in advance.

mushi
 
Physics news on Phys.org
mushi said:
I have been trying to run a linux executable (written in fortran77) into my another code (also in fortran77). In Matlab, I did it with "system('./<filename>')". But I am not able to do it in fortran script as './' is not simply working for me.
The command (if there is one in your Fortran) may not be "system()" but I have no idea of other possibilities. The "./" prefix is nothing to do with the language; it's a shortcut in Unix that says the executable is located in the current directory. So if the executable is not located in what the op sys will see as the current directory, you should specify the full pathname instead, e.g., '/mnt/hd1/usr/mushi/bin/filename'.
 
Scroll down this

http://www.sdsc.edu/~tkaiser/f90.html

to see real random number generator Fortran programs written in Fortran 77 and Fortran 90.
 

Similar threads

Replies
4
Views
1K
Replies
18
Views
6K
Replies
3
Views
3K
Replies
6
Views
2K
Replies
1
Views
4K
Replies
3
Views
2K
Back
Top