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.
我有一个包含矩阵的单元格数组。我想获得单元格数组中每个元素长度的一维行向量。例子:
a = {[1, 2], [1, 8], [5, 2, 4]}; % b = ...? b == [ 2, 2, 3 ]
这可能不使用 for 循环吗?
cellfun是你的朋友。
cellfun
b = cellfun( @numel, a );