setfield mlist, tlist, またはlistの要素の値を変更する

## 呼び出し手順

    uL = setfield(a, v, L)

## パラメータ

L
  `list`, `tlist`, または`mlist`リスト：コンポーネントを変更する必要があるリスト.

a
  変更するコンポーネントのアドレス. 文字列として指定されたフィールド名, または正の整数として指定されたインデックスのいずれかになります. 詳細については, insertionをご覧ください.

v
  任意のScilabオブジェクト：割り当てる値

uL
  更新されたリスト

## 説明

`L=setfield(a,v,L)` addresses and changes the ith element of a list, in a unified way over lists, tlists and mlists.

For simple lists and for tlists, `L=setfield(a,v,L)` is equivalent to `L(a)=v`, that is simpler and should be preferred. The same stands for any mlist if the address `a` is a field's name.

However, for any mlist L, if `i` is an index, the insertion `L(i)=v` is not predefined, in order to let the user define an overload implementing a matrix-oriented insertion, if required. Yet `setfield(i,v,L)` is always defined, with the same meaning as for other list and tlist types.

## 例

For a tlist, `setfield(3, v, T)` is equivalent to `T(3)=v` :

    T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
    // The insertion is predefined:
    T(3) = [%t %t %f];
    T(3)

    T = setfield(3, [%f %t %f], T);
    T(3)

    --> T = tlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
    --> // The insertion is predefined:
    --> T(3) = [%t %t %f];
    --> T(3)
     ans  =
      T T F

    --> T = setfield(3, [%f %t %f], T);
    --> T(3)
     ans  =
      F T F

For a mlist, there is no predefined indexed insertion routine, to let the user define a matrix-oriented insertion overload if required.

    M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
    M.b = [%t %t %t];
    M.b                 // OK, while ...
    M(3) = [%f %t %f];  // => error

    // But a raw direct insertion with setfield() is always possible:
    M = setfield(3, [%t %f %t], M);
    getfield(3, M)

    --> M = mlist(['V','a','b'], [%z (1-%z) %z^2], [%f %t %t]);
    --> M.b = [%t %t %t];
    --> M.b                 // OK, while ...
     ans  =
      T T T

    --> M(3) = [%f %t %f];  // => error
    Function not defined for given argument type(s),
      check arguments or define function %b_i_V for overloading.

    --> // But a raw direct insertion with setfield() is always possible:
    --> M = setfield(3, [%t %f %t], M);
    --> getfield(3, M)
     ans  =
      T F T

## 参照

- insertion
- getfield

## 履歴

6.0.0

- The updated list is now returned, instead of being changed "in place".
- setfield() can no longer be used for cells arrays.