如何在matlab中仅删除列中的一定范围的单元格

How to delete only a range of cells in a column in matlab

我有一个 23x5 单元格数组,我正在尝试用一列中的空单元格替换除第一个单元格之外的所有单元格。

当我尝试 array{2:end,4}=[] 我得到 "The right hand side of this assignment has too few values to satisfy the left hand side."

仍然对 Matlab 如何处理不同的东西感到困惑 类,我也尝试过 array(2:end,4)=[] 并得到 "A null assignment can have only one non-colon index."

我知道 for 循环可以很容易地清空每个单元格的内容,但我觉得必须有更简单的解决方案来解决这个问题。

感谢您的帮助。

尝试使用:

array(2:end,4) = {[]}

例如:

>> array = cell(23,5);
>> array(:) = {1};
>> array(2:end,4) = {[]}
array = 

    [1]    [1]    [1]    [1]    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]
    [1]    [1]    [1]     []    [1]