# Find a column of Z direction in 3D model

1 Ansicht (letzte 30 Tage)
Sara am 19 Aug. 2021
Kommentiert: Sara am 20 Aug. 2021
Hello,
I am working on the 3D model. what I want to do is find a columns in Z direction.
So I can find the xy postions by using ginput function but I do not know how to find all positns postions in Z direction for xy poriton that I select.
filename = uigetfile('*.*')
A = importdata (filename);
symbole = A.textdata(:,1);
x0 = A.data(:,1);
y0 = A.data(:,2);
z0 = A.data(:,3);
figure,
scatter3(x0,y0,z0);
% view([0 0 1]);axis equal;
xlabel('x'); ylabel('y');zlabel('z')
G1 = ginput;
plot3(G1(1,1),G1(1,2),z0,'o', 'color','k');
As you can see I want to use xy postions that I obtained by using ginput to plot the z-direction coordinates for this specific xy.
what I get from that is code is NOT shown me right plot of z- dreiction in selected xy
NOTE:
I attached a txt file contains coordnates of xyz. I obtained this xyz coordinates from using VESTA.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

DGM am 20 Aug. 2021
Idk if this is more what you're after:
A = importdata('magnetite_DATA_1.txt');
symbole = A.textdata(:,1);
x0 = A.data(:,1);
y0 = A.data(:,2);
z0 = A.data(:,3);
scatter3(x0,y0,z0);
xlabel('x'); ylabel('y'); zlabel('z')
% do selection in 2D
view(2); axis equal; hold on
G1 = ginput;
% find the samples near G1
m = any(sqrt((x0-G1(:,1).').^2 + (y0-G1(:,2).').^2)<=0.65,2);
plot3(x0(m),y0(m),z0(m),'o', 'color','k');
view(3) % switch back to 3D This example shows two columns selected
##### 1 KommentarKeine anzeigenKeine ausblenden
Sara am 20 Aug. 2021

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!