필터 지우기
필터 지우기

Excluding NaN from Convhull calculation

조회 수: 3 (최근 30일)
William Sheehan
William Sheehan 2018년 7월 29일
답변: Image Analyst 2018년 7월 29일
Is there any way to carry out the 'convhull' function without removing NaN from the data. I know I could just remove a whole column or row that contains NaN but I would rather not do that. Is there any way around this ?

채택된 답변

Image Analyst
Image Analyst 2018년 7월 29일
Just use isnan() to remove points with a nan in them. Why not? That's how everyone would do it. Why not you? What's the reluctance to do that???
nanRows = any(isnan(xy), 2); % xy is N rows by 2 columns.
xy(nanRows, :) = [];
vertexIndices = convhull(xy(:, 1), xy(:, 2));
xHull = xy(vertexIndices, 1);
yHull = xy(vertexIndices, 2);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by