matlab中删除列的最快方法
我有一个139 X 143896的矩阵 我必须从中删除6000列 目前我正在使用for循环来完成它,它真的很慢 有没有更快的办法matlab中删除列的最快方法,matlab,vectorization,Matlab,Vectorization,我有一个139 X 143896的矩阵 我必须从中删除6000列 目前我正在使用for循环来完成它,它真的很慢 有没有更快的办法 for i=1:length(ind) %ind are the indices of the columns to be removed col1=ind(i); mat(:,col1)=[]; end 欢迎提供任何帮助。一次删除- mat(:,ind)=[]; 一次性删除- mat(:,ind)=[]; 不仅如此缓慢,还可能删除错误的列,因
for i=1:length(ind)
%ind are the indices of the columns to be removed
col1=ind(i);
mat(:,col1)=[];
end
欢迎提供任何帮助。一次删除-
mat(:,ind)=[];
一次性删除-
mat(:,ind)=[];
不仅如此缓慢,还可能删除错误的列,因为每次循环都在更改mat的大小。不仅如此缓慢,还可能删除错误的列,因为每次循环都在更改mat的大小。