单元格阵列的尺寸关闭 — 为什么?



代码给出错误

级联的不一致。

为什么?我已经创建了一个具有不同长度的不同字符串单元格的单元格数组,这不是一个问题,因为这是一个例子。

test = {'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'b' 'a' 'ddddddddddasdfasdfasdfadsfb' 'a' 'bdd'}

Questions = {'Constant' 'The teacher shows an interest in every student''s learning' 
'There is noise and disorder' 'Number of class periods per week in the test language'
'Number of class periods per week in mathematics' 'Number of class periods per week in science'
'Number of books at home' 'Having Desktop Computer' 'Having a Notebook' 'Having a Tablet' 'Having a Console' 'Having an eReader'};

你必须在每行的末尾放上省略号,这样它才能正确地继续水平连接:

Questions = {'Constant' 'The teacher shows an interest in every student''s learning' ...
'There is noise and disorder' 'Number of class periods per week in the test language' ...
'Number of class periods per week in mathematics' 'Number of class periods per week in science' ...
'Number of books at home' 'Having Desktop Computer' 'Having a Notebook' 'Having a Tablet' 'Having a Console' 'Having an eReader'};

在没有省略号的情况下,MATLAB将移动到下一行解释为放置分号(即垂直串联(,将后续值放置在下一行。在您的情况下,不同长度的行会被垂直连接,因此会出现尺寸不匹配错误。

相关内容

  • 没有找到相关文章

最新更新