Error using scatter . how to remove it

조회 수: 5 (최근 30일)
usama amjid
usama amjid 2015년 7월 15일
답변: Star Strider 2015년 7월 15일
"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');

채택된 답변

Star Strider
Star Strider 2015년 7월 15일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by