本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

MATLAB 中的 .NET 枚举

在 MATLAB® 中创建和合并 .NET 枚举

MATLAB 允许您利用 MATLAB 枚举类的特性和 .NET Framework 独有的一些特性来使用 .NET 枚举。

枚举包含成员、方法和基础值。应当了解的术语:

  • 枚举 - 在 MATLAB 中,具有有限的命名实例集合的类。在以下主题中,术语 enumeration 指的是 .NET 枚举。

  • 枚举成员 - 枚举类的命名实例。

  • 基础值 - 与枚举成员关联的数值。

注意

MATLAB 语言支持用户定义的枚举类。如果您使用的是在 MATLAB 中定义的枚举,请参阅创建 MATLAB 类枚举类别下的主题。

函数

bitnot.NET 枚举对象按位 NOT 实例方法

主题

Pass System.Enum Arguments

Examples using System.Enum arguments.

NetDocEnum Example Assembly

Example source code.

Work with Members of a .NET Enumeration

This example uses the System.DayOfWeek enumeration.

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

How to convert a .NET enumeration values.

Iterate Through a .NET Enumeration

This example shows how to display member names of the System.DayOfWeek enumeration.

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

This example shows how to combine members of an enumeration to create MATLAB variables.

Read Special System Folder Path

This example how to use the Microsoft® Environment.SpecialFolder enum.

Default Methods for an Enumeration

By default, MATLAB provides relational operators, conversion methods, and bitwise methods for a .NET enumeration.

Underlying Enumeration Values

MATLAB supports enumerations of any numeric type.

疑难解答

Limitations to Support of .NET Enumerations

.NET features not supported in MATLAB.