MATLAB Answers

Scatter() working but not Plot()

13 views (last 30 days)
Hello,
I am having trouble getting plot() to work. My code works if I use scatter() instead of plot(). If I used plot(), then I get Error in plot(x,y). Can someone please tell me why plot is not working? Thanks!
x = 1:10;
y = x.^2;
figure
hold on
plot(x,y)
hold off
  6 Comments
Kateri Kaminski
Kateri Kaminski on 2 Nov 2018
This is the full error. I am not sure why there is an indexing issue.
>> PostProcessing_filetest
Index exceeds matrix dimensions.
Error in PostProcessing_filetest (line 287)
plot(x,y)

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 2 Nov 2018
Edited: madhan ravi on 2 Nov 2018
Delete another .m file which has the same name plot.m or rename it
  9 Comments

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!