2 yuandian6945 yuandian6945 于 2017.09.04 11:12 提问

MATLAB,剔除粗大误差代码,求解释

function index = Restore(RemovedIndexCells, RemainingNum)

        marks = ones(RemainingNum, 1);      % 标记:0表示被删除,1表示被保留

for k = numel(RemovedIndexCells):-1:1

      temp = RemovedIndexCells {k};         % 从后向前取出粗大误差序号

        for m = 1:numel(temp)

                if  temp(m) == 1
          marks = [0; marks];
      else
          if   temp(m) > numel(marks)       % temp(m) == numel(marks) + 1
               marks = [marks; 0];
         else
               marks = [marks(1:temp(m) - 1); 0; marks(temp(m):end)];
         end
      end
end

end
index = find(marks < 1);

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.05 00:17
Csdn user default icon
上传中...
上传图片
插入图片