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.
我有一个大约 6000 行的单元格数组。接下来,我有一个带有一组行索引的向量,我们称之为removalIdx. 我想创建一个新的元胞数组,其中包含原始元胞数组中的所有行,除了removalIdx. 关于如何在不恢复到 for 循环的情况下执行此操作的任何想法?
removalIdx
以下示例代码应回答您的问题:
B = {'hello';'world';'are';'you';'there'}; %# Example cell array ToRemove = [2; 4]; %# Example indices to remove Soln = B; %# Create the new cell array Soln(ToRemove) = []; %# Remove the offending rows
注意:
>> Soln Soln = 'hello' 'are' 'there'