3D line plot between coordinates
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!