find
データ ディクショナリ セクションを検索
構文
説明
は、検索条件 foundEntries
= find(sectionObj
,PName1,PValue1,...,PNameN,PValueN
)PName1,PValue1,...,PNameN,PValueN
を使用してデータ ディクショナリ セクション sectionObj
を検索し、ターゲットのセクションで見つかった一致するエントリの配列を返します。この構文では、検索条件についてターゲットのセクションにあるエントリのプロパティが照合され、それらの値のプロパティは照合されません。データ ディクショナリ エントリのプロパティの一覧については、Simulink.data.dictionary.Entry
を参照してください。
は、追加の検索オプションを使用してデータ ディクショナリ エントリを検索します。たとえば、検索条件をターゲットのセクションにあるエントリの値と照合することができます。foundEntries
= find(sectionObj
,PName1,PValue1,...,PNameN,PValueN
,options
)
例
データ ディクショナリ セクションのすべてのエントリの配列を返す
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションに格納されているすべてのエントリを返します。
allEntries = find(dDataSectObj)
クラスを条件としてデータ ディクショナリ セクションを検索
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
myDictionary_ex_API.sldd
の [Design Data] セクションから、値が Simulink.Parameter
クラスのオブジェクトであるエントリを検索します。
foundEntries = find(dDataSectObj,'-value','-class','Simulink.Parameter')
変更ユーザーを条件としてデータ ディクショナリ セクションを検索
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
myDictionary_ex_API.sldd
の [Design Data] セクションから、最後に変更したユーザーが jsmith
であるエントリを検索します。
foundEntries = find(dDataSectObj,'LastModifiedBy','jsmith')
複数の条件を使用してデータ ディクショナリ セクションを検索
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
myDictionary_ex_API.sldd
の [Design Data] セクションから、最後に変更したユーザーが jsmith
であるエントリと名前が fuel
で始まるエントリを検索します。
foundEntries = find(dDataSectObj,'LastModifiedBy','jsmith','-or',... '-regexp','Name','fuel*')
正規表現を使用してデータ ディクショナリ セクションを検索
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
myDictionary_ex_API.sldd
の [Design Data] セクションから、名前が fuel
で始まるエントリを検索します。
foundEntries = find(dDataSectObj,'-regexp','Name','fuel*')
特定の値を条件としてデータ ディクショナリ セクションを検索
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションに格納されているすべてのエントリを返します。
allEntries = find(dDataSectObj);
値が 237
であるエントリを検索します。1 つを超えるエントリが見つかった場合は、foundEntries
という名前の配列に格納します。
foundEntries = []; for i = 1:length(allEntries) if getValue(allEntries(i)) == 237 foundEntries = [foundEntries allEntries(i)]; end end
特定のプロパティを条件としてデータ ディクショナリ セクションを検索
データ ディクショナリ myDictionary_ex_API.sldd
の [Design Data] セクションを dDataSectObj
という名前の Simulink.data.dictionary.Section
オブジェクトで表します。
myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd'); dDataSectObj = getSection(myDictionaryObj,'Design Data');
myDictionary_ex_API.sldd
の [Design Data] セクションから、値のプロパティが DataType
であるエントリを検索します。
foundEntries = find(dDataSectObj,'-value','-property','DataType')
入力引数
sectionObj
— 検索するデータ ディクショナリ セクション
Simulink.data.dictionary.Section
オブジェクト
検索するデータ ディクショナリ セクション。Simulink.data.dictionary.Section
オブジェクトとして指定します。この関数を使用する前に、関数 getSection
などを使用してターゲットのセクションを Simulink.data.dictionary.Section
オブジェクトで表しておきます。
PName1,PValue1,...,PNameN,PValueN
— 検索条件
プロパティを表す名前と値のペア
検索条件。ターゲットのデータ ディクショナリ セクションにあるエントリのプロパティの名前と値を表す 1 つ以上の名前と値のペアとして指定します。データ ディクショナリ エントリのプロパティの一覧については、Simulink.data.dictionary.Entry
を参照してください。名前と値のペアを 1 つを超えて指定した場合は、すべての条件に一致するエントリが返されます。
エントリの値を検索する '-value'
オプションを指定すると、検索条件がエントリ自体ではなくエントリの値に適用されます。
例: 'LastModifiedBy','jsmith'
例: 'DataSource','myRefDictionary_ex_API.sldd'
options
— 追加の検索オプション
サポートされるオプション コード
追加の検索オプション。サポートされる次の 1 つ以上のオプション コードとして指定します。
'-value' | このオプションを指定すると、find でターゲットのデータ ディクショナリ セクションにあるエントリの値だけが検索されます。このオプションは、他の検索条件や options 引数よりも前に指定します。 |
'-and' 、'-or' 、'-xor' 、'-not' の論理演算子 | これらのオプションは、複数の検索条件や他のオプション コードを修飾または結合するために使用します。 |
'-property',propertyName | この名前と値のペアを指定すると、find で propertyName プロパティ (値は任意) をもつエントリまたは値が検索されます。propertyName は文字ベクトルとして指定します。 |
'-class',className | この名前と値のペアを指定すると、find でクラス className のオブジェクトであるエントリまたは値が検索されます。className は文字ベクトルとして指定します。 |
'-isa',className | この名前と値のペアを指定すると、find でクラス className またはそのクラスから派生したサブクラスのオブジェクトであるエントリまたは値が検索されます。className は文字ベクトルとして指定します。 |
'-regexp' | このオプションを指定すると、検索条件で正規表現を使用できます。このオプションは '-regexp' の後に指定した検索条件にのみ適用されます。 |
例: '-value'
例: '-value','-property','CoderInfo'
例: '-value','-class','Simulink.Parameter'
出力引数
foundEntries
— 検索条件に一致するデータ ディクショナリ エントリ
Simulink.data.dictionary.Entry
オブジェクトの配列
指定された検索条件に一致するデータ ディクショナリ エントリ。Simulink.data.dictionary.Entry
オブジェクトの配列として返されます。
代替方法
モデル エクスプローラーを使用して、任意の条件でデータ ディクショナリ内のエントリを検索することができます。
バージョン履歴
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)