Reputation: 11
I am working with Matlab GUI. My problem is the plots are not updated when I change the input data. My code is long but here is the plotting function I am using:
axes(handles.Diagram1)
hold all
for i=1:6:numel(t)
plot(rn,E(i,:)/1000000)
end
set(axesHandle,'Diagram1','Diagram1');
The tag of the axis plot is "Diagram1!
How can I fix this?
Upvotes: 0
Views: 4063
Reputation: 1511
You can create a "clean figure" button, that 1) clears current axis (cla), 2) removes the legend, 3) clears the title, and sets any counter to 1. The figure is still there, but its contents are gone. Or you just include the code inside an "if":
function cleanbutton_Callback(source,eventdata)
cla
legend off
title ''
counter = 1;
end
Is this what you need?
Upvotes: 0
Reputation: 24127
MATLAB plots are not permanently linked to the data they display, so if you change the data after plotting, the plot will not be automatically updated. You would need to update the plot yourself after changing the data by reexecuting the plot command.
Upvotes: 1
Reputation: 697
I've never used it myself, but you're might looking for the drawnow
function - see documentation here
Upvotes: 0