本文介绍了单元格内容分配给非单元格数组对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于ch = 1:63对于h = 1:5
对于a = 1:6
对于b = 1:6 $ b对于ch = 1:63 $
$ BM {A,b} {H,CH} =零(4,4);
end
end
end
end
for a = 1:6
for b = 1:6
if b == a
for h = 1:5
for ch = 1:63
for c = 1:4
for d = 1:4
M {A,b} {H,CH} {C,d} = 1;
end
end
end
end
end
end
end
$ b 错误出现在第17行( m {a,b} {h,ch} {c,d} = 1;
),它显示单元格内容分配给一个非单元格数组对象。任何解决方案来解决这种类型的错误?
解决方案
这是一个可怕的代码。在第5行中将由 m {a,b} {h,ch}
引用的变量分配给4x4 数组而不是cellarray。因此,你应该把第17行改成
m {a,b} {h,ch}(c,d)= 1 ;
注意正则括号(当访问数组时)和花括号(当访问cellarrays时)之间的区别。 / p>
for ch=1:63
for h=1:5
for a=1:6
for b=1:6
m{a,b}{h,ch}=zeros(4,4);
end
end
end
end
for a=1:6
for b=1:6
if b==a
for h=1:5
for ch=1:63
for c=1:4
for d=1:4
m{a,b}{h,ch}{c,d}=1;
end
end
end
end
end
end
end
The error was appeared in line 17 ( m{a,b}{h,ch}{c,d}=1;
),it showed that the cell contents assignment to a non-cell array object. Any solution to solve this type of error?
解决方案
This is a horrible code.
As for the error, the variable referenced to by m{a,b}{h,ch}
was assigned in line 5 to a 4x4 array not a cellarray. Therefore, you should change line 17 to
m{a,b}{h,ch}(c,d)=1;
Note the difference between regular parentheses (when accessing arrays) and curly braces (when accessing cellarrays).
这篇关于单元格内容分配给非单元格数组对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!