removeEnumeral
データ ディクショナリの列挙データ型定義から列挙型メンバーを削除
説明
removeEnumeral(
は、typeObj
,memberNum
)typeObj
(Simulink.data.dictionary.EnumTypeDefinition
オブジェクト) に格納された列挙型定義から列挙型メンバーを削除します。
例
データ ディクショナリの列挙型定義をプログラムで作成
列挙型の定義を格納できるオブジェクトを作成します。既定では、新しい型には基となる整数値が 0
である列挙型メンバー enum1
が 1 つ定義されます。
myColors = Simulink.data.dictionary.EnumTypeDefinition
myColors = Simulink.data.dictionary.EnumTypeDefinition enum1
型の定義に列挙型メンバーをいくつか追加します。
appendEnumeral(myColors,'Orange',1,'') appendEnumeral(myColors,'Black',2,'') appendEnumeral(myColors,'Cyan',3,'') myColors
myColors = Simulink.data.dictionary.EnumTypeDefinition enum1 Orange Black Cyan
既定の列挙型メンバー enum1
を削除します。enum1
はリストの最初の列挙型メンバーであるため、インデックス 1
を指定します。
removeEnumeral(myColors,1) myColors
myColors = Simulink.data.dictionary.EnumTypeDefinition Orange Black Cyan
対応するオブジェクトのプロパティを設定して列挙型をカスタマイズします。
myColors.Description = 'These are my favorite colors.'; myColors.DefaultValue = 'Cyan'; myColors.HeaderFile = 'colorsType.h';
データ ディクショナリ myDictionary_ex_API.sldd
を開き、myDictionaryObj
という名前の Simulink.data.Dictionary
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
列挙型 myColors
を定義するオブジェクトをディクショナリにインポートします。
importFromBaseWorkspace(myDictionaryObj,'varList',{'myColors'});
入力引数
typeObj
— ターゲットの列挙型定義
Simulink.data.dictionary.EnumTypeDefinition
オブジェクト
ターゲットの列挙型定義。Simulink.data.dictionary.EnumTypeDefinition
オブジェクトとして指定します。
memberNum
— ターゲットの列挙型メンバーのインデックス
整数
ターゲットの列挙型メンバーのインデックス。整数として指定します。
列挙型定義の最初の列挙型メンバーのインデックスが 1
になります。たとえば、列挙型 BasicColors
で次のように定義されているとします。
myColors = Simulink.data.dictionary.EnumTypeDefinition Orange Black Cyan
列挙型メンバー Black
を削除するには memberNum
に 2
を指定します。列挙型メンバー Cyan
を削除するには 3
を指定します。
memberNum
の指定に列挙型メンバーの基となる整数値は使用しないでください。メンバーの基となる整数値はメンバーのインデックスと同じではありません。
例: 3
データ型: single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| double
代替方法
モデル エクスプローラーを使用して、Simulink.data.dictionary.EnumTypeDefinition
オブジェクトで表される列挙データ型から列挙型メンバーを削除することができます。
バージョン履歴
R2015a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)