×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how to call external program within fortran code?

how to call external program within fortran code?

how to call external program within fortran code?

(OP)
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

RE: how to call external program within fortran code?

(OP)
actually I've tried this but there is no sign of matlab and it is not running.
i don't know what is the problem.

RE: how to call external program within fortran code?

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)

RE: how to call external program within fortran code?

(OP)
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).
---------------------------------------------------------

RE: how to call external program within fortran code?

Have a look at the sample program in https://software.intel.com/en-us/forums/intel-visu...

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.

RE: how to call external program within fortran code?

No doubt it would need some work, but for a long term solution wouldn't it make more sense to re-write your application based in Matlab, and call the Fortran code from Matlab?

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close