Upgrading from MATLAB 4 to MATLAB 5.0     Search    Help Desk 

Enhanced Application Program Interface (API)

The MATLAB 5.0 API introduced data types and functions not present in MATLAB 4. This section summarizes the important changes in the API. For details on any of these topics, see the MATLAB Application Program Interface Guide.

New Fundamental Data Type

The MATLAB 4 Matrix data type is obsolete. MATLAB 5.0 programs use the mxArray data type in place of Matrix. The mxArray data type has extra fields to handle the richer data constructs of MATLAB 5.0.

Functions that expected Matrix arguments in MATLAB 4 expect mxArray arguments in MATLAB 5.0.

New Functions

The API introduced many new functions that work with the C language to support MATLAB 5.0 features.

Support for Structures and Cells

MATLAB 5.0 introduced structure arrays and cell arrays. Therefore, the MATLAB 5.0 API introduced a broad range of functions to create structures and cells, as well as functions to populate and analyze them. See Chapter 2 for a complete listing of these functions.

Support for Multidimensional Arrays

The MATLAB 4 Matrix data type assumed that all matrices were two-dimensional. The MATLAB 5.0 mxArray data type supports arrays of two or more dimensions. The MATLAB 5.0 API provides two different mxCreate functions that create either a two-dimensional or a multidimensional mxArray.

In addition, MATLAB 5.0 introduced several functions to get and set the number and length of each dimension in a multidimensional mxArray.

Support for Nondouble Precision Data

The MATLAB 4 Matrix data type represented all numerical data as double-precision floating-point numbers. The MATLAB 5.0 mxArray data type can store numerical data in six different integer formats and two different floating-point formats.

Note:
Although the MATLAB API supports these different data representations, MATLAB itself does not currently provide any operations or functions that work with nondouble-precision data. Nondouble precision-data may be viewed, however.

Enhanced Debugging Support

MATLAB 5.0 included more powerful tools for debugging C MEX-files. The
-argcheck
option to the mex script provides protection against accidental misuse of API functions (such as passing NULL pointers). In addition, there is increased documentation on troubleshooting common problems.

Enhanced Compile Mechanism

MATLAB 5.0 replaced the old cmex and fmex scripts with mex, which will compile C or Fortran MEX-files. All compiler-specific information was moved to easily readable and highly configurable options files. The mex script has a configurable set of flags across platforms and can be accessed from within MATLAB via the mex.m M-file.

MATLAB 4 Feature Unsupported in MATLAB 5.0

Non-ANSI C Compilers

MATLAB 4 let you compile MATLAB applications with non-ANSI C compilers. MATLAB 5.0 required an ANSI C compiler.



[ Previous | Help Desk | Next ]