1

私は行列と同じようにこれをやろうとしています:

>> line_params{1,:} = {numberPatterns{i}, lw, iw};
The right hand side of this assignment has too few values to satisfy the left hand side.

しかし、上記のエラーが発生します。

タイプは次のとおりです。

>> class(line_params)
ans =
cell

>> size(line_params)
ans =
    21     3

>> a={numberPatterns{i}, lw, iw};

>> class(a)
ans =
cell

>> size(a)
ans =
     1     3
4

1 に答える 1

3

変化する

line_params{1,:} = {numberPatterns{i}, lw, iw}

の中へ

line_params(1,:) = {numberPatterns{i}, lw, iw}

(通常の括弧)。

中括弧 ( {}) を使用する場合は、個々の要素を参照します。あれは、

line_params{1,:}

line_params最初の行のセル内の要素のコンマ区切りリストを返します。cell 配列 (単一項目) をコンマ区切りリスト (複数項目) に代入することはできません。

括弧 ( ()) を使用すると、セル エントリが参照されます。つまり、セル配列が返されます。また、セル配列 (単一項目) を別のセル配列 (単一項目) に割り当てることができます。もちろん、同じ次元を持っている場合に限ります。

于 2013-07-02T11:45:42.923 に答える