Matlab will not compile my C++ .exe file

3 次查看(过去 30 天)
Mini Me
Mini Me 2013-1-21
I have program in C++ that runs great but it has different steps in it. It opens a file first then does some calculations based on the data it gets from the file. Now I'm trying to run it through matlab. I tried mex but it got too complicated because I have VS 2010 Express and MATLAB 2007b. And so mex can never find my c compiler.
I'm now trying to just run it straight from the C++ program executable file through matlab. Here's how I tried to do it:
system('C:\path\file.exe')
it would act like it's compiling the command line window for the executable file does not come up and matlab command window freezes and I have to close Matlab every time to get back on track. So I wrote a sample code to open the file first before the system command open the .exe file. I've done something like M=fopen('fname','r'), but nothing works. Please note that this file I'm trying to open is a .COF file that the program uses to do calculations.
I tried running the .exe file using debug and release modes but nothing happens. It gives no errors which means it sees the .exe file but the command line doesn't come up and matlab command window freezes everytime
After running, it's supposed to prompt the user at the command line input then take input arguments and output results... I do not want to use MEX but if you have a simper way to get the C++ .exe to run through matlab i am opened to it.
Please help....
P.S im using VS 2010, MATLAB R2007b and MAtlab r2011a,Win7, 32 and 64 bit.

回答(2 个)

Walter Roberson
Walter Roberson 2013-1-21
VS 2010 Express is not supported for R2007b. Use VS 2005. See http://www.mathworks.com/support/compilers/release2007b/
  5 个评论
Mini Me
Mini Me 2013-1-22
Mr. Roberson, downloading VS 2005 and using it with Matlab R2007b did not a difference. Matlab still doesn't pull up the executable file when I call it. I simply write system('C:\file1\projects\Debug\myfile.exe') It acts like its compiling so I wait and wait and nothing comes up Any ideas
Jan
Jan 2013-1-24
It acts like it is compiling? Are there any arguments or observations which for this claim? An EXE-file is compiled already, and as long as this EXE is not a compiler itself I do not see any reasons for your assumption. It is more likely that your program hangs due to a bug. Can you exclude that?

请先登录,再进行评论。


Ryan Livingston
Ryan Livingston 2013-1-24
I would recommend trying the '-echo' option to SYSTEM. From the doc:
[status,cmdout] = system(command,'-echo')
additionally displays (echoes) the command output in the MATLAB® Command Window. This syntax is most useful for commands that require user input and that run correctly in the MATLAB Command Window.
Sometimes window output can not happen immediately. Also, if your program tries to redirect any of the streams like STDIN, STDOUT then issues could arise.

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by