"hold on" on plot does not work over 2 functions
Show older comments
I have two problem on my code regarding plotting points on a x-y plane.
My code is briefly summarized as follows in main.m and sketch.m;
main.m
plot(x,y,linespec); hold on;
sketch(n);
end
sketch.m
[hx,hy] = ginput(n);
for i = 1:n
plot(hx(i), hy(i), linespec); hold on;
end
What I want to achieve is that:
- Create a base x-y plane
- Get clicked x-y coordinates on the created x-y plane at the step 1.
- Plot all points onto the created x-y plane at the step 1.
And here is my problems;
My first problem is that:
ginput does not follow the x-y coordinate which is created in main file. I think the clicked data is on 1 by 1 x-y plane.
My second problem is that: plot in sketch.m does not work and the program itself freezes and MATLAB also crashes in the end.
If you know how to fix this problem, please let me know and help me out. Thank you so much in advance.
Accepted Answer
More Answers (1)
Selva Karna
on 29 Jul 2016
you can use
figure
Categories
Find more on Just for fun 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!