MATLAB: Plotting multilines with multi colours

3d plotscolorlineplot

I have a very big matrix called Vertices (100000 X 6 matrix) First 3 columns have x y z points. last 3 columns have the colour of that point. for eg first 2 rows are
7645 383 3 49 47 39
7649 382 4 38 37 31
I need to plot all the points with the defined colors.
for ii = 1:1000
plot3(Vertices(ii,1), Vertices(ii,2), Vertices(ii,3), 'color',[Vertices(ii,4)/255, Vertices(ii,5)/255, Vertices(ii,6)/255], 'Marker', '.');
hold on;
end
This works. I have tried for first 1000 element. But since my matrix size is very large. It take a lot of time if i plot using loop. Is there any easy way to plot this?

Best Answer

scatter3(Vertices(:,1), Vertices(:,2), Vertices(:,3),1, Vertices(:, 4:6)/255, 'filled'); % 3D scatter plot