Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call external program within fortran code?

Status
Not open for further replies.

zahedi66

Mechanical
Apr 13, 2015
30
0
0
IR
hello
I want to call matlab program within my fortran code. I have google about this but can't figure out how should I write the code. for example I just want to run matlab program. is the below code is true?
-------------------------------------
program Console9
implicit none

call SYSTEMQQ("C:\ProgramFiles\MATLAB\R2015b\bin\matlab.exe")

end program Console9
 
Replies continue below

Recommended for you

Program files is two separate words. You may also need a second set of quotes. If this doesn't work
Code:
call SYSTEMQQ("C:\Program Files\MATLAB\R2015b\bin\matlab.exe")
try this
Code:
call SYSTEMQQ(['"C:\Program Files\MATLAB\R2015b\bin\matlab.exe"')
Check that matlab is actually in Program Files. On some systems, it is in Program Files (x86)
 
thx for your reply but It doesn't work.
this error is occurred, It is not syntax error. google says that it may because of compiler or OS. My compiler is ifort.exe and OS is win10/64bit.
--------------------------------------------------------
'Console2.exe': Loaded 'C:\Windows\SysWOW64\imagehlp.dll'
'Console2.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll'
The thread 'Win32 Thread' (0x13f8) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1080) has exited with code 0 (0x0).
The program '[4488] Console2.exe: Native' has exited with code 0 (0x0).
---------------------------------------------------------
 
Have a look at the sample program in
It looks like you call matlab through COM. I think matlab.exe is just a front end which launches something else.

In most cases, the fortran programs assume that Matlab is already started. They don't try to launch matlab first. Check the process memory if you are successful - make sure your Fortran program has not grown excessively large from starting matlab.
 
Status
Not open for further replies.
Back
Top