필터 지우기
필터 지우기

Calling Visual Studios from MATLAB

조회 수: 12 (최근 30일)
Luca Fenech
Luca Fenech 2021년 3월 12일
댓글: Luca Fenech 2021년 3월 16일
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일
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
Image Analyst
Image Analyst 2021년 3월 15일
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);
Luca Fenech
Luca Fenech 2021년 3월 16일
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개)

카테고리

Help CenterFile Exchange에서 Historical Contests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by