Plot3 to mesh. Need to speed up my code
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello everyone,
i would like to accelerate my matlab code. The aim is to set up an array X-Y-Z for meshing based on a pointcloud Px-Py-Pz (each is a vector). The points Px and Py are arranged in a specific pattern. (I hope you can see the figure). My current solution is not fast enough, because I need to use this code quite often:
plot3(Px, Py, Pz,'.')
x = unique(Px);
y = unique(Py);
[X,Y] = meshgrid(x,y);
aX = X(1, :);
aY = Y(:, 1);
for k = 1:length(Pz)
index_x = find(aX == Px(k));
index_y = find(aY == Py(k));
Z(index_x, index_y) = Pz(k);
end
toc
mesh(X,Y,Z)
Do you have any ideas how to accelerate this code? Is it really necessary to use unique for that?
Regards
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Point Cloud Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!