Error using scatter . how to remove it

5 vues (au cours des 30 derniers jours)
usama amjid
usama amjid le 15 Juil 2015
"Error using scatter (line 60) X and Y must be vectors of the same length.
Error in elevation_plot (line 8) scatter(t,elevation,'.r')"
elevation = -80.1185,-78.2186,-76.2659,-74.2826,-72.2845,-70.2832,-68.2878,-66.3052,-64.3401,-62.3953,-60.4716,-58.5657,-56.6805,-54.8055,-52.9367,-51.0671,-49.1893,-47.2958,-45.3794,-43.4338,-41.4537,-39.4352,-37.3755,-35.2737,-33.1298,-30.9447,-28.7202,-26.4582,-24.1600,-21.8262,-19.4554,-17.0436,-14.0586,-12.0603,-9.4554,-6.7381,-3.6642,-0.7696,2.6382,6.49070,10.9625,16.2256,22.1809,27.5795,29.2701,25.6308,19.4589,13.3995,8.1741,3.7198,-0.1558,-3.6140,-6.7680,-9.6941,-12.4431,-15.0496,-17.5372,-19.9231; % 58 values
t=1:1:58; scatter(t,elevation,'.r');

Réponse acceptée

Star Strider
Star Strider le 15 Juil 2015
You forgot the square brackets ‘[]’ to make ‘elevation’ a vector.
This works:
elevation = [-80.1185,-78.2186,-76.2659,-74.2826,-72.2845,-70.2832,-68.2878,-66.3052,-64.3401,-62.3953,-60.4716,-58.5657,-56.6805,-54.8055,-52.9367,-51.0671,-49.1893,-47.2958,-45.3794,-43.4338,-41.4537,-39.4352,-37.3755,-35.2737,-33.1298,-30.9447,-28.7202,-26.4582,-24.1600,-21.8262,-19.4554,-17.0436,-14.0586,-12.0603,-9.4554,-6.7381,-3.6642,-.7696,2.6382,6.49070,10.9625,16.2256,22.1809,27.5795,29.2701,25.6308,19.4589,13.3995,8.1741,3.7198,-0.1558,-3.6140,-6.7680,-9.6941,-12.4431,-15.0496,-17.5372,-19.9231];
t=1:1:58;
scatter(t,elevation,'.r')

Plus de réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by