Tipos de datos .NET en MATLAB
Cuando se llama a un método o función de .NET, MATLAB convierte de forma automática los argumentos más primitivos de MATLAB en tipos de .NET. Para pasar un arreglo de cadenas, utilice la función cell. Para pasar arreglos de otros tipos de MATLAB, use la función NET.createArray. No es posible pasar arreglos de la estructura, arreglos dispersos o números complejos a métodos de .NET.
MATLAB convierte de forma automática los tipos de devolución .NET primitivos en tipos de MATLAB equivalentes, en caso de que existan. Para convertir un objeto System.String, llame a la función char. Si la función de .NET devuelve un arreglo, antes de usar los datos en un comando de MATLAB, utilice la función numérica correspondiente de MATLAB para arreglos rectangulares o la función cell para arreglos irregulares. Para convertir un diccionario de MATLAB a un objeto .NET correspondiente, llame a la función NET.createDictionary.
Funciones
NET.createArray | Array for nonprimitive .NET types |
NET.createDictionary | Generic .NET Dictionary (Desde R2023a) |
NET.disableAutoRelease | Lock .NET object representing RunTime Callable Wrapper (COM wrapper) |
NET.enableAutoRelease | Unlock .NET object representing RunTime Callable Wrapper (COM wrapper) |
Temas
- Pass Data to .NET Objects
MATLAB 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.Stringarguments. - Pass Cell Arrays of .NET Data
Tips for working with contents of nested
System.Objectarrays in MATLAB. - Leer arreglos de celdas de datos de una hoja de cálculo de Excel
Este ejemplo para Microsoft® .NET Framework muestra cómo convertir columnas de datos de hojas de cálculo de Microsoft Excel® a tipos de MATLAB.
- Pass System.Enum Arguments
Examples using
System.Enumarguments. - Pass System.Nullable Arguments
This example shows how to handle .NET methods with
System.Nullabletype arguments, whose underlying value type isdouble. - Pass Jagged Arrays
This example shows how to create a .NET jagged array of
System.Doubleusing theNET.createArrayfunction. - Convert Nested System.Object Arrays
This example shows how to use the
cellfunction to convert data in nestedSystem.Objectarrays. - 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
cellfunction to convertSystem.StringandSystem.Objectarrays to MATLAB cell arrays.
Solución de problemas
Limitations to Support of .NET Arrays
.NET features not supported in MATLAB.