Main Content

values

ディクショナリの値

R2022b 以降

    説明

    v = values(d) は、指定されたディクショナリの値を含む配列を返します。

    v = values(d,"cell") は、オプションで値を cell 配列として返します。

    すべて折りたたむ

    数値を string にマッピングする 3 つのキーと値のペアを含むディクショナリを作成します。

    names = ["Unicycle" "Bicycle" "Tricycle"];
    wheels = [1 2 3];
    d = dictionary(wheels,names)
    d =
    
      dictionary (double --> string) with 3 entries:
    
        1 --> "Unicycle"
        2 --> "Bicycle"
        3 --> "Tricycle"
    

    values を使用して、ディクショナリに格納されている値を含む配列を返します。

    v = values(d)
    v = 3x1 string
        "Unicycle"
        "Bicycle"
        "Tricycle"
    
    

    数値を 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"
    

    values を使用して、ディクショナリに格納されている値を含む配列を cell 配列として返します。

    v = values(d,"cell")
    v=3×1 cell array
        {["Unicycle"]}
        {["Bicycle" ]}
        {["Tricyle" ]}
    
    

    入力引数

    すべて折りたたむ

    ディクショナリ。dictionary オブジェクトとして指定します。d が未設定の場合、values はエラーをスローします。

    バージョン履歴

    R2022b で導入