根据索引号在matlab 3D散点图中按线连接点

Connect points by line in matlab 3D scatter plot according to index number

我需要根据索引号在matlab 3D散点图中用线连接点。到目前为止,我达到了这个状态

data = importdata('2.txt');
x = data (:,1);
y = data (:,2);
z = data (:,3);
MarkerSize = 50;
SizeVector = repmat(MarkerSize ,length(x),1);
ColorVector = summer(length(x));
h = scatter3(x,y,z,SizeVector,ColorVector,'filled');
view(-30,10)

enter image description here

P.S。 这个程序对我来说是新的。

我不确定我是否理解了问题。 line 不是您要找的吗?

x=[1 2 3];%let's say
y=[1 3 2];
z=[1 2 3];

figure;hold on
plot3(x,y,z)
line(x,y,z)%this links the dots in the order specified in when defining x,y and z