このページの翻訳は最新ではありません。ここをクリックして、英語の最新版を参照してください。
keys
説明
例
ディクショナリのキーのクエリ
数値を string にマッピングする 3 つのキーと値のペアを含むディクショナリを作成します。
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"
keys
を使用して、ディクショナリに格納されているキーを含む配列を返します。
k = keys(d)
k = 3×1
1
2
3
ディクショナリのキーを cell 配列として返す
数値を string にマッピングする 3 つのキーと値のペアを含むディクショナリを作成します。
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"
keys
とオプションの入力 "cell"
を使用して、ディクショナリに格納されているキーを含む配列を cell 配列として返します。
k = keys(d,"cell")
k=3×1 cell array
{[1]}
{[2]}
{[3]}
入力引数
d
— ディクショナリ
dictionary
オブジェクト
ディクショナリ。dictionary
オブジェクトとして指定します。d
が未設定の場合、keys
はエラーをスローします。
バージョン履歴
R2022b で導入
参考
dictionary
| entries
| values
| types
| numEntries
| isConfigured
| isKey
| keyHash
| keyMatch
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)