Documentation Center

  • Trial Software
  • Product Updates

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, for example, c:\work.

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

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

%xtimesy_help.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_help.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_help.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.

Was this topic helpful?