How do I reset data in my GUI?

2 次查看(过去 30 天)
Abhay Aradhya
Abhay Aradhya 2017-6-9
编辑: Stephen23 2017-6-10
I have quite a few elements in my GUI, when I re-render the elements of my GUI it seems that the position property points the last element of the GUI created.
customUserInterface = figure('Name','Solution selector window');
axesHandle1 = axes('Parent',customUserInterface,'Position',[.1 .5 .375 .4]);
hold on
plot3(axesHandle,Data(m).traj(:,1),Data(m).traj(:,2),Data(m).traj(:,3),'g','LineWidth',2)
aw = axes('Parent',customUserInterface,'Position',[.7 0.1 .2 .2]);
hold on;
bar(1:numSectors, [fitFun.sectSim(1,:)]')
hold on
title('Sector Similarity');
xlabel('Sector'); ylabel('sectSim');
hold off
reset(axesHandle) %I know this line is not necessary but just trying, with or without this line the problem exists
set(axesHandle,'Position',[.1 .5 .375 .4]); %I know this line is not necessary but just trying, with or without this line the problem exists
plot3(axesHandle,mData(m).traj(:,1),mData(m).traj(:,2),mData(m).traj(:,3),'g','LineWidth',2)
Please provide a workaround. Thanks in advance.
  4 个评论
Abhay Aradhya
Abhay Aradhya 2017-6-10
Found the solution thanks a lot Adam for triggering the thought process. Created a "handle" for every plot, deleted the handle using delete command as below
delete(handle_1);
Then redrew the plot/patch/bar using the respective functions
Stephen23
Stephen23 2017-6-10
编辑:Stephen23 2017-6-10
@Abhay Aradhya: using delete is not required. You do not need to completely delete plotted lines/patches/objects: Adam's suggestion of simply using set to redefine the XData and YData (and any other properties) is neater and much more efficient.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by