Plot3 to mesh. Need to speed up my code
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Point Cloud Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!