このページの翻訳は最新ではありません。ここをクリックして、英語の最新版を参照してください。
entries
説明
例
ディクショナリのエントリ
複数のキーと値のペアを含むディクショナリを作成します。
names = ["Unicycle" "Bicycle" "Tricyle"]; wheels = [1 2 3]; d = dictionary(wheels,names)
d = dictionary (double ⟼ string) with 3 entries: 1 ⟼ "Unicycle" 2 ⟼ "Bicycle" 3 ⟼ "Tricyle"
entries
を使用して、d
に格納されているエントリを含む table を返します。
E = entries(d)
E=3×2 table
Key Value
___ __________
1 "Unicycle"
2 "Bicycle"
3 "Tricyle"
構造体としてのディクショナリのエントリ
複数のキーと値のペアを含むディクショナリを作成します。
names = ["Unicycle" "Bicycle" "Tricyle"]; wheels = [1 2 3]; d = dictionary(wheels,names)
d = dictionary (double ⟼ string) with 3 entries: 1 ⟼ "Unicycle" 2 ⟼ "Bicycle" 3 ⟼ "Tricyle"
entries
を使用して出力形式を "struct"
として指定し、d
に格納されているエントリを含む struct
配列を返します。
E = entries(d,"struct")
E=3×1 struct array with fields:
Key
Value
入力引数
d
— ディクショナリ
dictionary
オブジェクト
ディクショナリ。dictionary
オブジェクトとして指定します。d
が未設定の場合、entries
はエラーをスローします。
format
— 出力形式
"table"
(既定値) | "struct"
| "cell"
出力形式。次の値のいずれかとして指定します。
"table"
— キーと値のペアを table に返します。この形式は既定の出力形式です。"struct"
—n
行 1 列の struct 配列を返します。ここで、n
個のstruct
要素にはそれぞれ、指定されたディクショナリ内のn
個の各エントリに対応するフィールドkey
およびvalue
があります。このオプションは、table と互換性のないデータ型の場合に使用します。"cell"
— キーと値のペアをn
行 2 列の cell 配列に返します。ここで、n
はエントリ数で、1 列目にはキーが含まれ、2 列目には値が含まれます。
バージョン履歴
R2022b で導入
参考
dictionary
| keys
| values
| types
| numEntries
| isConfigured
| isKey
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)