从matlab中的数组中按索引删除行

Removing rows by index from arrays in matlab

我有一个包含 2500*30 个元素的数组(其类型为“单个”),我需要删除几行我知道索引的行。例如:

duplicate_ids = [1,4:8,11,859,866,1673,2157,2187,2188,2194,2195];

我该怎么做?我的偏好是不写 for 循环,因为我可能会出错(当删除上一行时,下一行的索引将在每次旋转时改变)。

提前致谢

不幸的是,我目前没有有效的许可证,所以我无法对其进行测试以确保它可以正常工作,但基于 documentation on row-removal,我相信你可以那样做:

mat(duplicate_ids, :) = [];