Help CenterHelp Center
Array for nonprimitive .NET types
array = NET.createArray(typeName,[m,n,p,...])
array = NET.createArray(typeName,m,n,p,...)
example
array = NET.createArray(typeName,[m,n,p,...]) creates a multidimensional .NET array of type typeName.
typeName
m,n,p,...
array
array = NET.createArray(typeName,m,n,p,...) is an alternative syntax for creating an array.
You cannot specify the lower bound of an array.
collapse all
Create a .NET array of List<Int32> generic type.
List<Int32>
genType = NET.GenericClass('System.Collections.Generic.List','System.Int32'); arr = NET.createArray(genType,5)
arr = List<System*Int32>[] with properties: Length: 5 LongLength: 5 Rank: 1 SyncRoot: [1x1 System.Collections.Generic.List<System*Int32>[]] IsReadOnly: 0 IsFixedSize: 1 IsSynchronized: 0
Create a .NET array of three elements.
jaggedArray = NET.createArray('System.Double[]',3)
jaggedArray = Double[][] with properties Length: 3 LongLength: 3 Rank: 1 SyncRoot: [1x1 System.Double[][]] IsReadOnly: 0 IsFixedSize: 1 IsSynchronized: 0
Assign values to arrays of different dimensions.
jaggedArray(1) = [1,3,5,7,9]; jaggedArray(2) = [0,2,4,6]; jaggedArray(3) = [11,22];
Display the first value of the third array.
jaggedArray(3,1)
ans = 11
Create a jagged array of List<Double> generic type.
List<Double>
Define the generic type.
genCls = NET.GenericClass('System.Collections.Generic.List[]','System.Double');
Create the array.
genArr = NET.createArray(genCls,3)
genArr = List<System*Double>[][] with properties: Length: 3 LongLength: 3 Rank: 1 SyncRoot: [1×1 System.Collections.Generic.List<System*Double>[][]] IsReadOnly: 0 IsFixedSize: 1 IsSynchronized: 0
Create a jagged array of type System.Double[][][].
System.Double[][][]
netArr = NET.createArray('System.Double[][]',3)
netArr = Double[][][] with properties: Length: 3 LongLength: 3 Rank: 1 SyncRoot: [1x1 System.Double[][][]] IsReadOnly: 0 IsFixedSize: 1 IsSynchronized: 0
NET.GenericClass
Fully specified .NET array type name, specified as a string, character vector, or NET.GenericClass object.
Example: 'System.Double[]'
'System.Double[]'
Example: 'NET.GenericClass('System.Collections.Generic.List','System.Int32')'
'NET.GenericClass('System.Collections.Generic.List','System.Int32')'
Number of elements in each dimension, specified as an array of integers.
Introduced in R2009a
NET.convertArray | NET.createGeneric
NET.convertArray
NET.createGeneric
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office