How do I reset data in my GUI?

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 comentarios

Adam
Adam el 9 de Jun. de 2017
Editada: Adam el 9 de Jun. de 2017
I don't understand what your problem is. The position property of what? What are you actually trying to achieve? Your question title talks about resetting data, but I'm not seeing anything related to that in the question body other than lines that you commented have no effect (If lines of code have no effect then remove them from your question and give the simplest code possible to show the problem).
If all you want to do is change data in a plot you are far better off keeping the plotted object's handle and editing it e.g.
hLine = plot3(...)
...
set( hLine, 'XData', newXData, 'YData', newYData, 'ZData', newZData,... )
Abhay Aradhya
Abhay Aradhya el 10 de Jun. de 2017
Appreciate all the suggestions Adam. My problem is that there is only one axes on to which I am plotting a lot of data(through multiple plot statements).
So at a given point I just want to reset or re-plot only a specific data. Can you please suggest me a way to accomplish this?
Because set(..,....,..) command resets the entire data of the particular axes.
Abhay Aradhya
Abhay Aradhya el 10 de Jun. de 2017
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 el 10 de Jun. de 2017
Editada: Stephen23 el 10 de Jun. de 2017
@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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Jun. de 2017

Editada:

el 10 de Jun. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by