Borrar filtros
Borrar filtros

Excluding NaN from Convhull calculation

3 visualizaciones (últimos 30 días)
William Sheehan
William Sheehan el 29 de Jul. de 2018
Respondida: Image Analyst el 29 de Jul. de 2018
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 ?

Respuesta aceptada

Image Analyst
Image Analyst el 29 de Jul. de 2018
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);

Más respuestas (0)

Categorías

Más información sobre Computational Geometry en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by