plot some nodes from an .txt file

2 views (last 30 days)
Hi! I would like to hope if there is an easy way to plot only the outermost nodes (the red nodes in the figure).
I am leaving the filename.txt file representing the nodes.

Accepted Answer

Mathieu NOE
Mathieu NOE on 1 Dec 2022
hello Alberto
here you are ; use function boundary with shrink factor = 1
data = readmatrix('filename.txt');
x = data(:,1);
y = data(:,2);
% k = boundary(___,s) specifies shrink factor s using any of the previous syntaxes.
% s is a scalar between 0 and 1. Setting s to 0 gives the convex hull,
% and setting s to 1 gives a compact boundary that envelops the points.
% The default shrink factor is 0.5.
s = 1;
k = boundary(x,y,s);
plot(x,y, 'db', x(k), y(k), '-r')
  25 Comments
Alberto Acri
Alberto Acri on 4 Jan 2023
Hi @Mathieu NOE! Can I ask you again for your help? Using the attached files (the files you had attached previously), I noticed a "problem" with the file test_114_check.txt of which I also attach an image.
How can I do to extrapolate, even for this curve, only the outer coordinates?
I thank you for your help in advance!
Mathieu NOE
Mathieu NOE on 4 Jan 2023
Edited: Mathieu NOE on 4 Jan 2023
hello Alberto
happy new year !!
for your problem above, simply increase Fd for the second method until you get the expected results
file : code_v3.m
%% test 3 : with find_delaunay_boundary03_fig1
% (from Fex : https://fr.mathworks.com/matlabcentral/fileexchange/60690-boundary-extraction-identification-and-tracing-from-point-cloud-data?s_tid=ta_fx_results )
% Fd = 1.5; %Fd = dmax (max point to point distance)
Fd = 3; %Fd = dmax (max point to point distance)

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!