Calling an external application/program from a compiled Matlab program

Calling an external application/program from a compiled Matlab program

Post by Ackba » Sat, 09 Oct 2004 06:55:29


I was wondering if anyone knows how to properly call an external
program in compiled Matlab program. I have tried to use (which works
if the program is not compiled):
dos('file.exe');
but that gives an error. If I use:
!file;
it does not work properly for what I need to do (although in this
situation it can actually find the program and run certain programs,
just not the program of interest) b/c I think a new command window
has to be open for the particular program of interest to work. I
have verified that using "dos('file.exe');" in the command window
works and tried other means to verify that running the program works
outside of matlab and inside Matlab. It seems that the problem is
particular to Matlab being unable to use "dos" correctly in the
compiled version.

For reference, I am using Matlab 7.0.1 with Compiler 4.1.

Thanks.
 
 
 

Calling an external application/program from a compiled Matlab program

Post by Peter Web » Sun, 10 Oct 2004 02:13:07


What error are you seeing?

 
 
 

Calling an external application/program from a compiled Matlab program

Post by Ackba » Sun, 10 Oct 2004 02:22:22

Figured out my problem. The error was just that it wouldn't even
find the file when using "dos" and using other commands (such as
winopen) it wouldn't run the program. The error resides in the fact
that I was trying to call a program that was compiled in a previous
version of Matlab Compiler (3.0). But this is a necessary step to
resolving my other problem (being able to CORRECTLY print a plot in a
program compiled from Compiler 4.1). Apparently when you use:
dos('file.exe');
it doesn't even bother to try running the program though. I just
ended up using:
winopen('file.exe');
and it actually ran the program. BTW- was able to run files compiled
from Matlab Compiler 3.0 by putting the necessary .dll files right
into the directory.

This solution works perfectly and I can now properly print with a
compiled Matlab program.

Thanks anyways.




external