Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个条件来检查单元格数组是否为空,然后移至下一个。
我得到这个索引超过矩阵尺寸
期待着听到您的意见
您可以使用isempty检查元素是否为空:
isempty
C = cell(5,1); C{2} = 2; for ind = 1:length(C) if ~isempty(C{ind}) disp(['Processing C{' num2str(ind) '}']); end end
并且永远不要让索引C超出length(C)。
C
length(C)