只是努力寻找另一种实现方式来摆脱这种for循环。有没有办法摆脱缓慢的for-loop?谢谢你的帮助!
list = randi(2000,[2000 1]);
val = randi(2000,[2000 3000]);
for ii = 1:length(list)
[y,x] = find( val == list(ii) );
minx = min(x);
maxx = max(x);
minx1 = ceil(minx + 0.05 * (maxx - minx ));
maxx2 = ceil(maxx - 0.02 * (maxx - minx ));
val(y,minx:minx1) = 0;
val(y,maxx2:maxx) = 0;
end