How do I set up MATLAB Visual Add-in in a Microsoft Visual C/C++ environment?

19 Ansichten (letzte 30 Tage)
I would like an explanation on how to setup MATLAB Visual Add-in in a Microsoft Visual C/C++ environment.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 14 Nov. 2016
The MATLAB Add-in for Visual Studio has been obsoleted as of the release of MATLAB 7.0 (R14). If you are using a previous release of MATLAB, read the following:
MathWorks provides a MATLAB Add-in for the Visual Studio development system that lets you work easily within Microsoft Visual C/C++ (MSVC). Note that MATLAB Add-in is not compatible with Microsoft Visual Studio .Net or the versions of Microsoft Visual C/C++ later than 5.0 or 6.0.
The MATLAB Add-in for Visual Studio greatly simplifies using MATLAB files in the MSVC environment. The Add-in automates the integration of MATLAB files into Visual C++ projects. It is fully integrated with the MSVC environment.
The Add-in for Visual Studio is automatically installed on your system when you run either mbuild -setup or mex -setup and select Microsoft Visual C/C++ version 5 or 6. However, there are several steps you must follow in order to use the Add-in:
1. To build MEX-files with the Add-in for Visual Studio, run the following command at the MATLAB command prompt.
mex -setup
Follow the menus and choose either Microsoft Visual C/C++ 5.0 or 6.0. This configures Mex to use the selected Microsoft compiler and also installs the necessary Add-in files in your Microsoft Visual C/C++ directories.
2. To build stand-alone applications with the MATLAB Add-in for Visual Studio (requires the MATLAB Compiler and the MATLAB C/C++ Math Libraries), run the following command at the MATLAB command prompt.
mbuild -setup
Follow the menus and choose either Microsoft Visual C/C++ 5.0 or 6.0. This configures mbuild to use the selected Microsoft compiler and also installs the necessary add-in files into your Microsoft Visual C/C++ directories. (It is not a problem if these overlap with the files installed by the mex -setup
command.)
3. For either Mex or stand-alone support, you should also run the following commands at the MATLAB prompt.
cd(prefdir); mccsavepath;
These commands save your current MATLAB path to a file named mccpath in your user preferences directory. (Type prefdir to see the name of your user preferences directory.)
NOTE: This step is necessary because the MATLAB Add-in for Visual Studio runs outside of the MATLAB environment, so it would have no way to determine your MATLAB path. If you add directories to your MATLAB path and want them to be visible to the MATLAB Add-in, rerun the cd and mccsavepath commands shown in this step and replace prefdir with the desired pathname.
4. To configure the MATLAB Add-in for Visual Studio to work with Microsoft Visual C/C++:
a. Select Tools -> Customize from the MSVC menu.
b. Click on the Add-ins and Macro Files tab.
c. Check MATLAB for Visual Studio on the Add-ins and Macro Files list and click Close. The floating MATLAB Add-in for Visual Studio toolbar appears. The checkmark directs MSVC to automatically load the add-in when you start MSVC again.
Note: To run the MATLAB Add-in for Visual Studio on Windows 95 or Windows 98 systems, add this line to your config.sys file.
shell=c:\command.com /e:32768 /p
Note: If you are using Windows ME, refer to the related solution listed below:
For additional information on the MATLAB Add-in for Visual Studio:
- See the MATLABAddin.hlp file in the matlabroot\bin\win32 directory where 'matlabroot' is the output of the MATLAB command prompt when 'matlabroot' is executed, or
- Click on the Help icon in the MATLAB add-in for Visual Studio toolbar

Weitere Antworten (0)

Kategorien

Mehr zu COM Component Integration finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by