メインコンテンツ

.NET と厳密に型指定された MATLAB コード間のデータ型マッピング

C# から MATLAB

次の表では、C# データ型から厳密に型指定された MATLAB® データ型へのマッピングを示します。

説明C# データ型 MATLAB データ型表現

実数の double

  • スカラー

  • ベクトル

  • 配列


  • System.Double

  • System.Double[]

  • System.Double[,,...]


  • (1,1) double {mustBeReal}

  • (1,:) double {mustBeReal}

  • (1,:,:,...) double {mustBeReal}

複素数の double

  • スカラー

  • ベクトル

  • 配列

MATLAB では他の数値型の複素数はサポートされていません。


  • Numerics.Complex

  • Numerics.Complex[]

  • Numerics.Complex[,,...]


  • (1,1) double

  • (1,:) double

  • (1,:,:,...) double

実数の single

  • スカラー

  • ベクトル

  • 配列


  • System.Single

  • System.Single[]

  • System.Single[,,...]


  • (1,1) single {mustBeReal}

  • (1,:) single {mustBeReal}

  • (1,:,:,...) single {mustBeReal}

実数の整数

  • スカラー

  • ベクトル

  • 配列

  • System.SByte

  • System.SByte[]

  • System.SByte[,,...]

  • System.Int16

  • System.Int16[]

  • System.Int16[,,...]

  • System.Int32

  • System.Int32[]

  • System.Int32[,,...]

  • System.Int64

  • System.Int64[]

  • System.Int64[,,...]

  • System.Byte

  • System.Byte[]

  • System.Byte[,,...]

  • System.UInt16

  • System.UInt16[]

  • System.UInt16[,,...]

  • System.UInt32

  • System.UInt32[]

  • System.UInt32[,,...]

  • System.UInt64

  • System.UInt64[]

  • System.UInt64[,,...]

  • (1,1) int8 {mustBeReal}

  • (1,:) int8 {mustBeReal}

  • (1,:,:,...) int8 {mustBeReal}

  • (1,1) int16 {mustBeReal}

  • (1,:) int16 {mustBeReal}

  • (1,:,:,...) int16 {mustBeReal}

  • (1,1) int32 {mustBeReal}

  • (1,:) int32 {mustBeReal}

  • (1,:,:,...) int32 {mustBeReal}

  • (1,1) int64 {mustBeReal}

  • (1,:) int64 {mustBeReal}

  • (1,:,:,...) int64 {mustBeReal}

  • (1,1) uint8 {mustBeReal}

  • (1,:) uint8 {mustBeReal}

  • (1,:,:,...) uint8 {mustBeReal}

  • (1,1) uint16 {mustBeReal}

  • (1,:) uint16 {mustBeReal}

  • (1,:,:,...) uint16 {mustBeReal}

  • (1,1) uint32 {mustBeReal}

  • (1,:) uint32 {mustBeReal}

  • (1,:,:,...) uint32 {mustBeReal}

  • (1,1) uint64 {mustBeReal}

  • (1,:) uint64 {mustBeReal}

  • (1,:,:,...) uint64 {mustBeReal}

logical

  • スカラー

  • ベクトル

  • 配列


  • System.Boolean

  • System.Boolean[]

  • System.Boolean[,,...]


  • (1,1) logical

  • (1,:) logical

  • (1,:,:,...) logical

char

  • スカラー

  • ベクトル

  • 配列


  • System.Char

  • System.Char[]

  • System.Char[,,...]


  • (1,1) char

  • (1,:) char

  • (1,:,:,...) char

string

  • スカラー

  • ベクトル

  • 配列


  • System.String

  • System.String[]

  • System.String[,,...]


  • (1,1) string

  • (1,:) string

  • (1,:,:,...) string

enum

  • スカラー

  • ベクトル

  • 配列


  • System.Enum

  • System.Enum[]

  • System.Enum[,,...]


  • (1,1) MyEnumClass

  • (1,:) MyEnumClass

  • (1,:,:,...) MyEnumClass

MATLAB から C#

次の表では、厳密に型指定された MATLAB データ型から C# データ型へのマッピングを示します。

説明 MATLAB データ型C# データ型表現

実数の double

  • スカラー

  • ベクトル

  • 配列


  • (1,1) double {mustBeReal}

  • (1,:) double {mustBeReal}

  • (1,:,:,...) double {mustBeReal}


  • System.Double

  • System.Double[]

  • System.Double[,,...]

複素数の double

  • スカラー

  • ベクトル

  • 配列

結果が実数であっても複素数として保存されます。


  • (1,1) double

  • (1,:) double

  • (1,:,:,...) double


  • Numerics.Complex

  • Numerics.Complex[]

  • Numerics.Complex[,,...]

実数の single

  • スカラー

  • ベクトル

  • 配列


  • (1,1) single {mustBeReal}

  • (1,:) single {mustBeReal}

  • (1,:,:,...) single {mustBeReal}


  • System.Single

  • System.Single[]

  • System.Single[,,...]

実数の整数

  • スカラー

  • ベクトル

  • 配列

  • (1,1) int8 {mustBeReal}

  • (1,:) int8 {mustBeReal}

  • (1,:,:,...) int8 {mustBeReal}

  • (1,1) int16 {mustBeReal}

  • (1,:) int16 {mustBeReal}

  • (1,:,:,...) int16 {mustBeReal}

  • (1,1) int32 {mustBeReal}

  • (1,:) int32 {mustBeReal}

  • (1,:,:,...) int32 {mustBeReal}

  • (1,1) int64 {mustBeReal}

  • (1,:) int64 {mustBeReal}

  • (1,:,:,...) int64 {mustBeReal}

  • (1,1) uint8 {mustBeReal}

  • (1,:) uint8 {mustBeReal}

  • (1,:,:,...) uint8 {mustBeReal}

  • (1,1) uint16 {mustBeReal}

  • (1,:) uint16 {mustBeReal}

  • (1,:,:,...) uint16 {mustBeReal}

  • (1,1) uint32 {mustBeReal}

  • (1,:) uint32 {mustBeReal}

  • (1,:,:,...) uint32 {mustBeReal}

  • (1,1) uint64 {mustBeReal}

  • (1,:) uint64 {mustBeReal}

  • (1,:,:,...) uint64 {mustBeReal}

  • System.SByte

  • System.SByte[]

  • System.SByte[,,...]

  • System.Int16

  • System.Int16[]

  • System.Int16[,,...]

  • System.Int32

  • System.Int32[]

  • System.Int32[,,...]

  • System.Int64

  • System.Int64[]

  • System.Int64[,,...]

  • System.Byte

  • System.Byte[]

  • System.Byte[,,...]

  • System.UInt16

  • System.UInt16[]

  • System.UInt16[,,...]

  • System.UInt32

  • System.UInt32[]

  • System.UInt32[,,...]

  • System.UInt64

  • System.UInt64[]

  • System.UInt64[,,...]

logical

  • スカラー

  • ベクトル

  • 配列


  • (1,1) logical

  • (1,:) logical

  • (1,:,:,...) logical


  • System.Boolean

  • System.Boolean[]

  • System.Boolean[,,...]

char

  • スカラー

  • ベクトル

  • 配列


  • (1,1) char

  • (1,:) char

  • (1,:,:,...) char


  • System.Char

  • System.Char[]

  • System.Char[,,...]

string

  • スカラー

  • ベクトル

  • 配列


  • (1,1) string

  • (1,:) string

  • (1,:,:,...) string


  • System.String

  • System.String[]

  • System.String[,,...]

enum

  • スカラー

  • ベクトル

  • 配列


  • (1,1) MyEnumClass

  • (1,:) MyEnumClass

  • (1,:,:,...) MyEnumClass


  • System.Enum

  • System.Enum[]

  • System.Enum[,,...]

MATLAB cell

  • スカラー

  • ベクトル

  • 配列


  • (1,1) cell

  • (1,:) cell

  • (1,:,:,...) cell


  • System.Object

  • System.Object[]

  • System.Object[,,...]

structdictionary など、対応する C# の型がない MATLAB 型の場合、生成される型は dynamic です。

参考

|

トピック