Error in xlim and ylim?

124 views (last 30 days)
Anne Nguyen
Anne Nguyen on 29 Sep 2019
Commented: Johannes Matthias on 14 Nov 2022 at 10:43
This is the code I have so far:
xlabel('Distance (m)');
ylabel('Ball Height (m)');
title('Ball Trajectory');
xlim([0 3]);
ylim([-1 2]);
There is an error saying "Array indices must be positive integers or logical values. Error in task4 (line 21) xlim([0 3]);"
Why is this so? I thought I used the xlim function correctly? How do I fix this? Thank you!

Accepted Answer

Walter Roberson
Walter Roberson on 29 Sep 2019
At some point you accidentally created a variable named xlim
  1 Comment
Johannes Matthias
Johannes Matthias on 14 Nov 2022 at 10:43
You're my hero

Sign in to comment.

More Answers (0)


Find more on Startup and Shutdown in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by