This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Create and combine .NET enumerations in MATLAB®


bitand Bit-wise AND
bitor Bit-wise OR
bitxor Bit-wise XOR
bitnot .NET enumeration object bit-wise NOT instance method


.NET Enumerations in MATLAB

MATLAB allows you to work with .NET enumerations using features of the MATLAB enumeration class and some features unique to the .NET Framework.

Pass System.Enum Arguments

An example of an enumeration is System.DayOfWeek.

NetDocEnum Example Assembly

The C# example NetDocEnum.cs, in the matlabroot/extern/examples/NET/NetSample folder, defines enumerations used in examples.

Work with Members of a .NET Enumeration

To display the member names of an enumeration, use the MATLAB enumeration function.

Refer to a .NET Enumeration Member

You use an enumeration member in your code as an instance of an enumeration.

Display .NET Enumeration Members as Character Vectors

To get the descriptive name of an enumeration, use the char method.

Convert .NET Enumeration Values to Type Double

To convert a value to a MATLAB double, type:

Iterate Through a .NET Enumeration

To create MATLAB arrays from an enumeration, use the static System.Enum methods GetNames and GetValues.

Use .NET Enumerations to Test for Conditions

With relational operators, you can use enumeration members in if and switch statements and other functions that test for equality.

Use Bit Flags with .NET Enumerations

Many .NET languages support bit-wise operations on enumerations defined with the System.Flags attribute.

Read Special System Folder Path

Default Methods for an Enumeration

By default, MATLAB provides the following methods for a .NET enumeration:

Underlying Enumeration Values

MATLAB supports enumerations of any numeric type.


Limitations to Support of .NET Enumerations

You cannot create arrays of .NET enumerations, or any .NET objects, in MATLAB.

Was this topic helpful?