I have a program that is written in visual studios. Its extention is '.snl'. So to compile this program I go to visual studios, and press 'run'. Is it possible that instead I run this program from Visual Studios, I go to MATLAB, and MATLAB will call visual studios and run the program.
I have been doing some research to try and use the 'Mex File Functions', but till know I had no luck.
Any help would be appreciated. Thanks.

 채택된 답변

Image Analyst
Image Analyst 2021년 3월 12일

0 개 추천

In Visual Studio, clicking Run does not compile the solution. It runs the program. To compile the code into a standalone executable you need to go to the Build menu and then select Rebuild Solution. Make sure the configuration says "Release" and that you have set up the Build/Configuration Manager to build the output executable in Release mode.
Once Visual Studio has built the executable, you can run the executable from MATLAB with the system() function. I believe it's the best way. Trying to have MATLAB launch Visual Studio, load your solution, and then run it from within Visual Studio will be A LOT harder. It's probably possible if you use ActiveX since most or almost most Microsoft programs can be controlled via ActiveX function calls. But it's a lot harder. Your best bet is to make the executable and simply run it with the system() function.

댓글 수: 4

Luca Fenech
Luca Fenech 2021년 3월 12일
I really appreciate for your prompt reply and for your detailed answer. Thanks a lot!
I opened Visual Studios and left on the code that I want to run.
I searched about the system () function.... and now I ended with this code
status = system(['set PATH='C:\Users\fenec\Documents\IC Imaging Control 3.5\classlib\x64\debug\HighSpeedCapture.exe ' && ' dosCommand])
Is it possible to guide me of what I should write in the 'dosCommand' please?
Your dosCommand should have whatever command line arguments you want to send into the program.
programName = 'C:\Users\fenec\Documents\IC Imaging Control 3.5\classlib\x64\debug\HighSpeedCapture.exe';
commandLineArguments = 'whatever you want';
% Now combine them into one character array.
systemCommand = sprintf('%s %s', programName, commandLineArguments);
system(systemCommand);
Thanks for the info.
I managed since than the program opened and worked
I just wrote this code:
status = system(' c:\Users\fenec\Documents\IC Imaging Control 3.5\classlib\x64\debug\HighSpeedCapture.exe ')
Thanks a lot for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

2021년 3월 12일

댓글:

2021년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by