Plotting every nth point from a table for a scatter3 plot

Hi,
I am using a scatter3 to plot easting, northing and elevation data from a text file loaded in as a table. I have 1,520,371 points but only wish to plot every 10th point. Is there a function that will allow me to do this? Thanks in advance!

 Réponse acceptée

If I understand correctly what you want to do, this should work:
x = rand(1520371,1); % Create Data
y = rand(1520371,1); % Create Data
z = rand(1520371,1); % Create Data
T = table(x, y, z); % Create Table
plot3(T{1:10:end,1}, T{1:10:end,2}, T{1:10:end,3})
grid on
The approach will be the same even if the vector sizes are incorrect here.

4 commentaires

Thank you! I think we're getting there. When I tried that, it gave me a cubed plot. It should look more like the shape of an island. Should I index table.Eastingmeters, table.Northingmeters, table.Elevationmeters as x, y, and z? This is my current code:
T = readtable("C:\Users\Kaylyn\Documents\CE_566\BeachRecovery\Lidar_data\Job520480_2001_USGS_ATM_raw\AltJob520480_2001_USGS_ATM_raw.txt");
scatter3(table.Eastingmeters,table.Northingmeters,table.Elevationmeters, 'b','filled')
x=rand(1,1520371);
y=rand(1,1520371);
z=rand(1,1520371);
plot3(x(1:10:end),y(1:10:end),z(1:10:end));
grid on
My pleasure!
Do this:
T = readtable("C:\Users\Kaylyn\Documents\CE_566\BeachRecovery\Lidar_data\Job520480_2001_USGS_ATM_raw\AltJob520480_2001_USGS_ATM_raw.txt");
scatter3(table.Eastingmeters(1:10:end),table.Northingmeters(1:10:end),table.Elevationmeters(1:10:end), 'b','filled')
I do not have your data, so I can only test my code with synthetic data. That is the reason it appeared as a cube.
Thank you so much, Star!
That absolutely worked.
My pleasure!
If my Answer helped you solve your problem, please Accept it!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by