Tipi di dati .NET in MATLAB
Quando si chiama un metodo o una funzione .NET, MATLAB converte automaticamente la maggior parte degli argomenti primitivi di MATLAB in tipi .NET. Per passare un array di stringhe, utilizzare la funzione cell
. Per passare array di altri tipi di MATLAB, utilizzare la funzione NET.createArray
. Non è possibile passare array di strutture, array radi o numeri complessi ai metodi .NET.
MATLAB converte automaticamente i tipi primitivi di ritorno .NET in tipi equivalenti di MATLAB, se esistenti. Per convertire un oggetto System.String
, chiamare la funzione char
. Se la funzione .NET restituisce un array, prima di utilizzare i dati in un comando di MATLAB, utilizzare la funzione numerica di MATLAB corrispondente per gli array rettangolari o la funzione cell
per gli array stracciati. Per convertire un dizionario di MATLAB in un oggetto .NET corrispondente, chiamare la funzione NET.createDictionary
.
Funzioni
NET.createArray | Array for nonprimitive .NET types |
NET.createDictionary | Generic .NET Dictionary (Da R2023a) |
NET.disableAutoRelease | Lock .NET object representing RunTime Callable Wrapper (COM wrapper) |
NET.enableAutoRelease | Unlock .NET object representing RunTime Callable Wrapper (COM wrapper) |
Argomenti
- 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.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 for Microsoft® .NET Framework 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
arrays. - 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.
Risoluzione dei problemi
Limitations to Support of .NET Arrays
.NET features not supported in MATLAB.