2013-07-27 159 views
0

我创建了一个细胞与MATLAB单元阵列操作

s = cell(4,4); 

现在我想编辑两个条目:

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

我已经试过了以下几件事: Š{1,1:2 } = {A,B}; s {1,1:2} = {A; B}; s {1,1:2} = {{A},{B}}; 但他们都没有工作。

它总是说:'这个任务的右手边的数值太少,无法满足左手边。

我该怎么做?

在此先感谢!

回答

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'  [] 
     []  []   []  [] 
     []  []   []  [] 
     []  []   []  []