我正在尝试在 2D 单元格数组行的末尾附加一个元素。我的代码是:
b = cell(5, 0)
b(1) = {b(1, :), 2} % Trying to append at the end of the first row
这给了我错误:error: A(I) = X: X must have the same size as I
我还尝试了各种其他形式,例如:
b = cell(5, 0)
b(1, end+1) = 2 % Ok, inserts 2 at [1,1]
b(2, end+1) = 3 % No, inserts 3 at [2,2] instead of [2, 1]