0

我用

s = cell(4,4);

现在我想编辑两个条目:

s{1,1:2} = ?? //what do I write here?

我尝试了以下方法: s{1,1:2} = {A,B}; s{1,1:2} = {A;B}; s{1,1:2} = {{A},{B}};但它们都不起作用。

它总是说:“这个赋值的右侧的值太少,无法满足左侧的要求。”

我怎样才能做到这一点?

提前致谢!

4

1 回答 1

0

利用

s(1,1:2) = {A,B};

例子:

>> s(1,1:3) = {'first','second','third'}

s = 

    'first'    'second'    'third'     []
         []          []         []     []
         []          []         []     []
         []          []         []     []


>> A=12

A =

    12

>> B=4

B =

     4

>> s(1,1:2) = {A,B}

s = 

    [12]    [4]    'third'     []
      []     []         []     []
      []     []         []     []
      []     []         []     []
于 2013-07-27T16:18:42.087 回答