Fortran alternative to Matlab 'system' command

In summary, the conversation is about trying to run a Linux executable written in Fortran77 into another Fortran77 code. The individual has successfully done so in Matlab using the command "system('./<filename>'), but is having trouble executing it in a Fortran script. They are asking for an alternative command to execute the executable file into the Fortran code. The response suggests using the full pathname instead of the shortcut "./" and provides a website with examples of Fortran programs using random number generators.
  • #1
mushi
23
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
  • #2
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'.
 
  • #3
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.
 

FAQ: Fortran alternative to Matlab 'system' command

What is Fortran?

Fortran is a high-level programming language commonly used in scientific and engineering applications. It was first developed in the 1950s and has since undergone several updates and revisions.

What is Matlab?

Matlab is a proprietary programming environment and language commonly used for numerical computing and data analysis. It is widely used in scientific and engineering fields.

What is the 'system' command in Fortran?

The 'system' command in Fortran is a built-in function that allows the program to run external commands or programs from within the Fortran code. It is often used for executing system-level tasks or calling other programs.

Why would someone want a Fortran alternative to the 'system' command in Matlab?

There are a few reasons why someone may prefer to use a Fortran alternative to the 'system' command in Matlab. These may include better performance, more control over the execution of external commands, or the need to integrate Fortran code into a larger project.

What are some examples of Fortran alternatives to the 'system' command in Matlab?

Some examples of Fortran alternatives to the 'system' command in Matlab include the intrinsic 'EXECUTE_COMMAND_LINE' function and the 'SYSTEM' subroutine in the Fortran standard library. Other options may also exist depending on the specific Fortran compiler or development environment being used.

Similar threads

Replies
18
Views
5K
Replies
3
Views
2K
Replies
4
Views
2K
Replies
2
Views
3K
Replies
3
Views
2K
Replies
4
Views
13K
Replies
6
Views
2K
Replies
6
Views
4K
Back
Top