Matlab 如何在单元格数组中的两个单元格中设置数字

Matlab 如何在单元格数组中的两个单元格中设置数字,matlab,cell,cells,Matlab,Cell,Cells,可能重复: 我试图在第2列的所有空单元格中输入一个数字,比如说3 像这样: emptyList = cellfun(@isempty,anscell) anscell{emptyList(:,2),2}=3 但我得到的信息是 The right hand side of this assignment has too few values to satisfy the left hand side. 我可以不用循环和创建sum和one函数来克服它吗?这是否符合您的要求 [anscell{e

可能重复:

我试图在第2列的所有空单元格中输入一个数字,比如说3

像这样:

emptyList = cellfun(@isempty,anscell)
anscell{emptyList(:,2),2}=3
但我得到的信息是

The right hand side of this assignment has too few values to satisfy the left hand side.

我可以不用循环和创建sum和one函数来克服它吗?

这是否符合您的要求

[anscell{emptyList(:,2),2}] = deal(3)
这是你需要的吗

anscell = cell(3,2)
emptyList = cellfun(@isempty,anscell)
anscell(emptyList(:,2),2)={3}

嗯,可能是这样,但还是不行。我想因为我进入手机的方式不好,可能是吗?