I have the following script where with the command "scatter3" I obtain a figure present in "object_analysis.txt" where in correspondence of the nodes I have a determined color (that varies for all the nodes of the object).
A(:,:)=load('object_an.txt');
figure
scatter3(A(:,1),A(:,2),A(:,3), 6, A(:,5:7)./255, 'filled');
grid on
axis equal
I would like to bring back the mesh (triangular elements) of this element "object" so that on the surface you can see the color variation set previously.

3 件のコメント

Image Analyst
Image Analyst 2020 年 12 月 14 日
Not quite sure what you mean. When I run it I see a bunch of points plotted in various colors but mostly green. Do you want to see the triangle boundaries like with a Delaunay triangulation?
% Read in data
xyzValues = load('object_an.txt')
x = xyzValues(:,1);
y = xyzValues(:,2);
z = xyzValues(:,3);
% Do a 3-D scatter plot.
markerColors = xyzValues(:,5:7)/255
scatter3(x, y, z, 6, markerColors, 'filled');
% Prepare the diagram.
grid on
axis equal
title('Scatter Plot of (x, y, z)', 'FontSize', 20);
xlabel('x', 'FontSize', 20);
ylabel('y', 'FontSize', 20);
zlabel('z', 'FontSize', 20);
Alberto Acri
Alberto Acri 2020 年 12 月 14 日
I want to bring back the mesh that has the color variation obtained from the dots.
Image Analyst
Image Analyst 2020 年 12 月 14 日
Bring back WHAT mesh? Did one ever exist yet? Still not sure what you mean. Plus have have the color variation. It's in the markerColors matrix I created from columns 5-7.
Did you every try out KSSV's suggestion?

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2020 年 12 月 14 日

0 投票

6 件のコメント

Alberto Acri
Alberto Acri 2020 年 12 月 15 日
Thanks, but that's not what I'm looking for.
KSSV
KSSV 2020 年 12 月 15 日
Why not? What did you try?
Alberto Acri
Alberto Acri 2020 年 12 月 15 日
I want to create like this in matlab starting from the txt file.
KSSV
KSSV 2020 年 12 月 15 日
Yes the given generates the same.
Alberto Acri
Alberto Acri 2020 年 12 月 15 日
Really? But where should I look? There are many files inside.
KSSV
KSSV 2020 年 12 月 15 日
Read the documentation of delaunayTriangulation. This is pretty striaght. If you want to use the package, read the introduction part shown in the file mesh2d. There are few example, which will work out for your case.
There are also demo files which you can striaght away run and learn.

サインインしてコメントする。

カテゴリ

製品

リリース

R2020a

質問済み:

2020 年 12 月 14 日

コメント済み:

2020 年 12 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by