Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Document Build Information in the MEX File

This example shows how to document the xtimesy MEX file built on a Windows® platform using a Microsoft® Visual C++® compiler.

When you share a MEX file, your users need the following information about the configuration used to build the MEX file:

  • MATLAB® version.

  • Build platform.

  • Compiler.

Copy the source file to a folder on your MATLAB path.

copyfile(fullfile(matlabroot,'extern','examples','refbook','xtimesy.c'),'.')

Create a help file, xtimesy.m, and copy the header information from the source file.

% xtimesy.m Help file for XTIMESY MEX file
%
% XTIMESY Multiplies a scalar and a matrix
%   C = XTIMESY(b,A) multiplies scalar b with matrix A, 
%   and returns the result in C
%
%   MEX File function.

Identify your MATLAB version.

v = ver('matlab');
v.Release
ans =
(R2012a)

Identify your platform.

archstr = computer('arch')
archstr =
win64

Identify the MEX file extension.

ext = mexext
ext =
mexw64

Identify your C compiler.

cc = mex.getCompilerConfigurations('C','Selected');
cc.Name
ans =
Microsoft Visual C++ 2008 (C)

Add this information to the help file.

% xtimesy.m Help file for XTIMESY MEX file 
%
% XTIMESY Multiplies a scalar and a matrix
%   C = XTIMESY(b,A) multiplies scalar b with matrix A, 
%   and returns the result in C
%
%   Created with: 
%   MATLAB R2012a
%   Platform: win64
%   Microsoft Visual C++ 2008 

%   MEX File function.

Provide your users with the following.

  • xtimesy.mexw64

  • xtimesy.m

  • Instructions for downloading and installing the runtime library from the Microsoft Visual C++ 2008 Redistributable Package.

  • If you build a MEX file with a third-party library, instructions for acquiring and installing the necessary files.

Related Examples

Was this topic helpful?