yuandian6945
yuandian6945
采纳率0%
2017-09-04 03:12 阅读 5.0k

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条回答 默认 最新

相关推荐