How to use plot3 with Pointwise Coordinates

1 visualizzazione (ultimi 30 giorni)
Sven
Sven il 17 Lug 2015
Modificato: Sven il 17 Lug 2015
Hi,
I want to plot data that is stored in arrays containing their coordinates with plot3, as Point1 containing [x1,y1,z1] and draw lines between them. But I do not want to pass them one coordinate each. My favorite notation would be something like:
point1 = [1 1 1];
point2 = [2 2 2];
plot3(point1,'marker','.','MarkerSize',25);
plot3(point2,'marker','.','MarkerSize',25);
plot3(point1, point2, 'LineStyle', ':', 'LineWidth', 2);
Limited by my current knowledge I would write the plot lines as:
plot3(point1(1),point1(2),point1(3),'marker','.','MarkerSize',25);
plot3(point2(1),point2(2),point2(3),'marker','.','MarkerSize',25);
plot3([point1(1),point2(1)],[point1(2),point2(2)],[point1(3),point2(3)], 'LineStyle', ':', 'LineWidth', 2);
But this appears overly cumbersome to me. Is there any command or trick I missed. Can I pass an array with point coordinates to plot3 or is there a way to pass the array elementwise with an elegant trick.
P.S.: I have named the points as point1 and point2 for clarity usually I would store them in an array of points.

Risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by