Main Content

.NET Data Types in MATLAB

Data conversion, pass data between MATLAB® and .NET

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 the cell function. To pass arrays of other MATLAB types, use the NET.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 a System.String object, call the char 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 the cell function for jagged arrays. To convert a MATLAB dictionary to a corresponding .NET object, call the NET.createDictionary function.


NET.createArrayArray for nonprimitive .NET types
NET.createDictionaryGeneric .NET Dictionary (depuis R2023a)
NET.disableAutoReleaseLock .NET object representing RunTime Callable Wrapper (COM wrapper)
NET.enableAutoReleaseUnlock .NET object representing RunTime Callable Wrapper (COM wrapper)


Résolution des problèmes

Limitations to Support of .NET Arrays

.NET features not supported in MATLAB.