MATLAB GUI axes(handles.axes1) does not work?
Show older comments
Hello;
I have this simple code that is supposed to draw the line having its slope and y intercept. But when I use axes(handles.axes1);
nothing happens. What should I do?
2 Comments
the cyclist
on 18 Aug 2013
Can you post a self-contained example that we can run that shows what you mean, in context?
Tina
on 18 Aug 2013
Edited: Image Analyst
on 19 Aug 2013
Answers (1)
Image Analyst
on 19 Aug 2013
axes() just switches focus to that particular axes control. It does not actually do any plotting at all. For that you'll need to use the plot() function
plot(x, y, 'bo-', 'LineWidth', 2, 'MarkerSize', 10);
grid on;
axis on;
ylabel('Y', 'FontSize', 30);
xlabel('X', 'FontSize', 30);
4 Comments
Tina
on 19 Aug 2013
Image Analyst
on 19 Aug 2013
I do it all the time, so there's something you're not telling me - some code you're not sharing. You need to examine what the values of x and y are. Please learn how to use the debugger so you can quickly solve these yourself rather than the slow and tedious method of "debugging via the Answers forum": http://blogs.mathworks.com/videos/category/gui-or-guide/
Md Nafiul Islam
on 21 Dec 2017
Dear, I have used the same code and I draw the line but I need two line of the same graph. Do anyone help me how I update this code to two line. TIA
Walter Roberson
on 21 Dec 2017
hold on
plot(x2, y2);
Categories
Find more on Labels and Styling 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!