Use Help Files with MEX-Files

You can document the behavior of your MEX-files by writing a MATLAB® script containing comment lines. The help command automatically finds and displays the appropriate text when help is requested and the interpreter finds and executes the corresponding MEX-file when the function is invoked.

For example, copy the following text from the arrayProduct.c MEX source file into a file, arrayproduct.m.

% arrayproduct.m Help file for arrayProduct MEX-file.
%  arrayProduct.c - example in MATLAB External Interfaces
% 
%  Multiplies an input scalar (multiplier) 
%  times a 1xN matrix (inMatrix)
%  and outputs a 1xN matrix (outMatrix)
% 
%  The calling syntax is:
% 
% 		outMatrix = arrayProduct(multiplier, inMatrix)
% 

%  This is a MEX-file for MATLAB.
%  Copyright 2007-2014 The MathWorks, Inc.
% 

When you type:

help arrayproduct

MATLAB displays the comments.

See Also

Related Examples

Was this topic helpful?