how do i regenerate my plot by defining start time and end time(x-axis of my plot) in matlab gui?

7 views (last 30 days)
I have new to matlab. I have gui where I plot data.Now I want to use two edit buttons where I define my start time in one and end time in the other.Based on these 2 points,I want to replot my graph using a push button. Any help will be appreciated.

Accepted Answer

Image Analyst
Image Analyst on 24 Jan 2015
Try looking at these functions: cla(), plot(), xlim(), get(). Something like
cla; % Clear existing graph.
x1 = str2double(get(handles.editX1, 'string'));
x2 = str2double(get(handles.editX2, 'string'));
y = some equation using x, x1, and x2.
plot(x, y, 'b-');
xlim(x1, x2);
grid on;

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output 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!