3D line plot between coordinates
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
proczell
am 23 Jan. 2018
Beantwortet: proczell
am 23 Jan. 2018
I am trying to make a function that draws lines between given coordinates in a MAT file. As an example, the MAT file can look as following. Where the second and third column are the x coordinates for the start and end of the point, the 4th and 5th for y and 6th and 7th for z.
The function nearly works as intended, and draws the three lines i specified. However, it adds one lines from (0,-6,24) to (18,-6,0). Anyone have an idea of how to make the function only draw the number of lines specified from the MAT file?
[1] [0] [ 0] [-6] [-6] [ 0] [ 24]
[1] [0] [ 18] [-6] [-6] [ 0] [ 0]
[1] [0] [14.5000] [-6] [-6] [24] [2.5000]
n = size(A.save_lines);
for i = 1:n(1)
X_start(i,1) = A.save_lines{i,2};
X_end(i,1) = A.save_lines{i,3};
Y_start(i,1) = A.save_lines{i,4};
Y_end(i,1) = A.save_lines{i,5};
Z_start(i,1) = A.save_lines{i,6};
Z_end(i,1) = A.save_lines{i,7};
end
X = [X_start , X_end]
Y = [Y_start , Y_end]
Z = [Z_start , Z_end]
X = reshape(X.',1,[])
Y = reshape(Y.',1,[])
Z = reshape(Z.',1,[])
line(X,Y,Z)
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!