Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In general, you run the <code>mex</code> command with the <code>-g</code> option, and depending on your OS, either attach to MATLAB (Visual Studio in Windows) or start the debugger with the <code>matlab</code> startup script (e.g. <code>matlab -Dgdb</code> in Linux). Use <a href="http://www.mathworks.com/help/matlab/matlab_external/debugging-c-c-language-mex-files.html" rel="nofollow">these detailed instructions</a> for your own MEX files.</p> <p>However, for LIBSVM, you are provided with <code>make.m</code>, which can be used to build in any supported OS, and <code>Makefile</code> for use in Linux only. The Makefile is used for building the MEX files <em>outside</em> of MATLAB (i.e. without using <code>mex.m</code>, but instead a shell script in <code>$(MATLABDIR)/bin/mex</code>). In Windows, you need to edit <code>make.m</code> and add the <code>-g</code> option to each <code>mex</code> call:</p> <pre> mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims <b>-g</b> libsvmread.c mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims <b>-g</b> libsvmwrite.c mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims <b>-g</b> svmtrain.c ../svm.cpp svm_model_matlab.c mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims <b>-g</b> svmpredict.c ../svm.cpp svm_model_matlab.c </pre> <p>Then, <em>in MATLAB</em>, run <code>make</code> (the modified make.m). Start Visual Studio, set one or more break points, and from the Debug menu, "Attach to Process...". Now you can run the MEX functions (e.g. <code>svmtrain</code>) and it will stop in Visual Studio when it hits the break points.</p> <p>Just for completeness, if you were using Linux and wanted to go the Makefile route, just change the following line to build debug versions of the code:</p> <pre><code>MEX_OPTION += -largeArrayDims -g </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload