Filter löschen
Filter löschen

Calling Visual Studios from MATLAB

12 Ansichten (letzte 30 Tage)
Luca Fenech
Luca Fenech am 12 Mär. 2021
Kommentiert: Luca Fenech am 16 Mär. 2021
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.

Akzeptierte Antwort

Image Analyst
Image Analyst am 12 Mär. 2021
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 Kommentare
Image Analyst
Image Analyst am 15 Mär. 2021
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 am 16 Mär. 2021
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Historical Contests finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by