Examples


Use this example index to jump to code examples in the documentation.

Calling C and Fortran Programs from MATLAB

The explore Example
Examples From the Text
MEX Reference Examples
MX Examples
Engine and MAT Examples

Creating C Language MEX-Files

Passing Structures and Cell Arrays
Passing Two or More Inputs or Outputs
Passing Strings
A First Example -- Passing a Scalar
Handling Complex Data
Handling Sparse Arrays
Manipulating Multidimensional Numerical Arrays
Handling 8-,16-, and 32-Bit Data
Persistent Arrays
Calling Functions from C MEX-Files
Symmetric Indefinite Factorization Using LAPACK

Creating Fortran MEX-Files

Passing Matrices
Passing Arrays of Strings
Passing Strings
A First Example -- Passing a Scalar
Passing Two or More Inputs or Outputs
Handling Sparse Matrices
Dynamically Allocating Memory
Handling Complex Data
Calling Functions from Fortran MEX-Files

Calling MATLAB from C and Fortran Programs

Calling MATLAB From a C Application
Calling MATLAB From a Fortran Application

Calling Java from MATLAB

Concatenating Java Objects
Finding the Public Data Fields of an Object
Methodsview: Displaying a Listing of Java Methods
Converting to a MATLAB Structure
Converting to a MATLAB Cell Array
Passing Java Objects
Creating a Copy of a Java Array
Creating a New Array Reference
Creating an Array of Objects Within MATLAB
Creating and Using a Phone Book
Communicating Through a Serial Port
Finding an Internet Protocol Address
Reading a URL

Importing and Exporting Data

Reading a MAT-File in C
Creating a MAT-File in C
Creating a MAT-File in Fortran
Reading a MAT-File in Fortran

COM and DDE Support

Using COM Collections
Using MATLAB as an Automation Client
Writing Event Handlers
BSTR Execute([in] BSTR Command);
Using Visual Basic and the MATLAB DDE Server
DDE Advisory Links

Serial Port I/O

Getting Started
Reading Binary Data
Parsing Input Data Using strread
Writing and Reading Text Data
Connecting Two Modems
Using Events and Callbacks
Saving and Loading
Recording Information to Disk