Windows executable works in cmd but not using Matlab system() oder dos() functions

7 views (last 30 days)
I am tying to run a program (FCEA2.exe) from Matlab. When I enter the command line in Windows using cmd (running as admin), it works perfectly fine using
R:\FCEA2
However, when I try using
dos('R:\FCEA2')
in Matlab (running Matlab as admin) I get this error:
At line 3455 of file cea2.f (unit = 14, file = 'thermo.lib')
Fortran runtime error: End of file
The same thing happens using system() instead of dos(). I get the same problem when I force Windows to use my own user account via runas in cmd, even though I have admin privileges. I am using Windows 7 and the academic version of Matlab 2015a. Does anyone know a way to solve this problem?
  4 Comments
Ed Yu
Ed Yu on 14 Sep 2015
I think the error is pretty clear, where is your 'thermo.lib'? Is it in the PATH env. variable when launching MATLAB?
Walter Roberson
Walter Roberson on 14 Sep 2015
Ed, note that if the problem were with opening the file then normally the failure would be at the open rather than getting end of file unexpectedly. It would depend upon the coding, of course.

Sign in to comment.

Accepted Answer

Johannes Gutsmiedl
Johannes Gutsmiedl on 21 Sep 2015
Edited: Johannes Gutsmiedl on 21 Sep 2015
Alright, I finally found some time to work on this problem again. I tried the dependency walker and indeed got some missing libraries, but according to a google search that is apparently a problem within the dependency walker tool itself.
I decided to try something I had not tested before: Instead of running the exe itself, I created a shortcut to it (named FCEA.lnk) and executed this shortcut using
start "FCEA" /b /wait FCEA.lnk
as the command to Windows from MATLAB. /b tells it to not open a new command window, /wait to only return once the process is done (otherwise MATLAB will continue without waiting for CEA to finish). While this seems like a pretty ugly hack, it works very well so far. I would be very glad if someone could tell me why though :)
Anyways, thanks for the comments!

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!