.NET Data Types inMATLAB
When you call a .NET method or function, MATLAB automatically converts most primitive MATLAB arguments into .NET types. To pass an array of strings, use thecell
function. To pass arrays of other MATLAB types, use theNET.createArray
function. You cannot pass structure arrays, sparse arrays, or complex numbers to .NET methods.
MATLAB automatically converts primitive .NET return types to equivalent MATLAB types, if they exist. To convert aSystem.String
object, call thechar
function. If the .NET function returns an array, before using the data in a MATLAB command, use the corresponding MATLAB numeric function for rectangular arrays, or thecell
function for jagged arrays.
Functions
NET.createArray |
数组nonprimitive .NET types |
NET.disableAutoRelease |
Lock .NET object representing RunTime Callable Wrapper (COM wrapper) |
NET.enableAutoRelease |
Unlock .NET object representing RunTime Callable Wrapper (COM wrapper) |
Topics
- Pass Data to .NET Objects
MATLAB automatically converts method arguments into .NET types.
- Handle Data Returned from .NET Objects
Mapping C# .NET types to MATLAB types.
- Pass Numeric Arguments
MATLAB automatically converts .NET numeric data to and from equivalent MATLAB data.
- Pass System.String Arguments
Examples using
System.String
arguments. - Pass Cell Arrays of .NET Data
Tips for working with contents of nested
System.Object
arrays in MATLAB. - Read Cell Arrays of Excel Spreadsheet Data
This example shows how to convert columns of Microsoft®Excel®spreadsheet data to MATLAB types.
- Pass System.Enum Arguments
Examples using
System.Enum
arguments. - Pass System.Nullable Arguments
This example shows how to handle .NET methods with
System.Nullable
type arguments, whose underlying value type isdouble
. - Pass Jagged Arrays
This example shows how to create a .NET jagged array of
System.Double
using theNET.createArray
function. - Convert Nested System.Object Arrays
This example shows how to use the
cell
function to convert data in nestedSystem.Object
数组。 - Use Arrays with .NET Applications
MATLAB automatically converts arrays to .NET types, as described in the MATLAB Primitive Type Conversion Table.
- Convert .NET Arrays to Cell Arrays
Use the
cell
function to convertSystem.String
andSystem.Object
arrays to MATLAB cell arrays.
Troubleshooting
Limitations to Support of .NET Arrays
.NET features not supported in MATLAB.