Release 11 New Features |
MATLAB C/C++ Math Library 2.0
MATLAB C Math Library 2.0
Summary of New Features
The MATLAB C Math Library 2.0 supports these new features:varargin
/varargout
)
mbuild
script
Over 60 New Functions
New functions in the library support multidimensional arrays, cell arrays, MATLAB structures, and sparse arrays.Automated Memory Management for Temporary Arrays
The functionsmlfAssign()
, mlfEnterNewContext()
, mlfRestorePreviousContext()
, and mlfReturnValue()
provide automated memory management for temporary arrays. Using these functions, you can embed calls to library functions as function arguments. You don't need to declare mxArray*
variables to store temporary values, or explicitly delete those temporary arrays.
Data Types
Multidimensional Arrays. Multidimensional arrays in MATLAB can have more than two dimensions. You access a two-dimensional matrix element with two indices: a row index and a column index. In a multidimensional array, use additional subscripts for indexing. For example, a three-dimensional array has three indices and a four-dimensional array has four. Cell Arrays. Cell arrays are a special class of MATLAB arrays where elements, or cells, contain MATLAB arrays. Cell arrays allow you to store dissimilar classes of arrays in the same array. Cell arrays can be multidimensional. MATLAB Structures. MATLAB structures are a class of MATLAB arrays that can store dissimilar arrays together. MATLAB structures differ from cell arrays in that you reference them by named fields. Structure arrays can be multidimensional. Sparse Matrices. Sparse arrays are two-dimensional matrices that contain a significant number of zero-valued elements. An efficient matrix storage format stores only the nonzero values.New Indexing Functions
Three new indexing functions handle indexing for n-dimensional arrays, including cell arrays, structure arrays, and sparse arrays:mlfIndexRef()
mlfIndexAssign()
mlfIndexDelete()
mlfArrayRef()
, mlfArrayAssign()
, and mlfArrayDelete()
, are still valid. However, you must use the new indexing functions to access support for multidimensional indexing, cell array indexing, structure indexing, and sparse indexing.
Variable Input and Output Argument Lists
MATLABvarargin
functions accept any number of input arguments. The library supports varargin
functions through standard ANSI C variable-length argument lists.
MATLAB varargout
functions return any number of output arguments. The library supports varargout
functions through the functions mlfVarargout()
and mlfIndexVarargout()
.
try and catch Blocks
The library'smlfTry
and mlfCatch
macros let you handle errors with try and catch blocks.
Improved mbuild Script
Thembuild
script automatically detects the location of your C/C++ compiler and determines whether you are compiling C or C++ code. You no longer need to use the -setup
option to configure mbuild
; however, it is available if you need to change compilers or customize the options that mbuild
uses.
mbuild
now creates DLLs in addition to executables.
MATLAB C++ Math Library 2.0
Summary of New Features
The MATLAB C++ Math Library 2.0 supports these new features:varargin
/varargout
)
mbuild
script
Over 60 New Functions
New functions in the library support multidimensional arrays, cell arrays, MATLAB structures, and sparse arrays.Data Types
Multidimensional Arrays. Multidimensional arrays in MATLAB can have more than two dimensions. You access a two-dimensional matrix element with two indices: a row index and a column index. In a multidimensional array, use additional subscripts for indexing. For example, a three-dimensional array has three indices and a four-dimensional array has four. Cell Arrays. Cell arrays are a special class of MATLAB arrays where elements, or cells, contain MATLAB arrays. Cell arrays allow you to store dissimilar classes of arrays in the same array. Cell arrays can be multidimensional. MATLAB Structures. MATLAB structures are a class of MATLAB arrays that can store dissimilar arrays together. MATLAB structures differ from cell arrays in that you reference them by named fields. Structure arrays can be multidimensional. Sparse Matrices. Sparse arrays are two-dimensional matrices that contain a significant number of zero-valued elements. An efficient matrix storage format stores only the nonzero values.New Indexing Functions
ThemwArray
member function cell()
implements indexing into cell arrays.
The mwArray
member function field()
implements indexing into structure arrays.
Variable Input and Output Argument Lists
MATLABvarargin
functions accept any number of input arguments. The library supports varargin
functions through the mwVarargin
class.
MATLAB varargout
functions return any number of output arguments. The library supports varargout
functions through the mwVarargout
class.
Improved mbuild Script
Thembuild
script automatically detects the location of your C/C++ compiler and determines whether you are compiling C or C++ code. You no longer need to use the -setup
option to configure mbuild
; however, it is available if you need to change compilers or customize the options that mbuild
uses.