How do I debug a MATLAB 7.4 (R2007a) C/C++ MEX-file in Intel Visual C++ 9.1 using Microsoft Visual Studio 2005?

7 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
1. To debug a MEX-file from within MATLAB, you must first compile the MEX-file with the -g option to the mex function. The -g option builds the MEX-file with debugging symbols included. For example:
mex -g yprime.c
On a 32–bit platform, this command creates the executable file yprime.mexw32.
2. Start the Microsoft Visual Studio 2005 Development Environment. Do not exit your MATLAB session.
3. On the Visual Studio Tools menu, select Attach to Processes. In the Processes dialog box, select the MATLAB process and click Attach.
4. Open the source files by selecting File > Open > File. Set a breakpoint on the desired line of code by right-clicking the line of code and clicking Insert Breakpoint on the context menu. If you have not yet run the executable file, ignore any "?" that appears with the breakpoint next to the line of code.
5. In MATLAB, start the executable file, which runs in the Microsoft debugging environment:
yprime(1,1:4)
For more information on how to debug in the Microsoft environment, refer to the Microsoft Development Environment documentation.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by