Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab中删除列的最快方法_Matlab_Vectorization - Fatal编程技术网

matlab中删除列的最快方法

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)=[]; 不仅如此缓慢,还可能删除错误的列,因

我有一个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)=[];

不仅如此缓慢,还可能删除错误的列,因为每次循环都在更改mat的大小。不仅如此缓慢,还可能删除错误的列,因为每次循环都在更改mat的大小。