Matlab - limpiar grafica GUI

 
Vista:

limpiar grafica GUI

Publicado por jordi_9 (14 intervenciones) el 02/07/2013 17:18:29
Hola! Estoy haciendo una interfaz grafica en la que tengo dos menús para representar en una misma gráfica, la primera la tengo puesta con plot y la segunda con subplot. La primera funciana bien, el problema es el subplot, que los superpone y cuando selecciono la opcion ninguna que deberia borrar el subplot no lo hace...

ALguna idea??

Dejo el código:


function Botones_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to PCA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%%%%%%%%%% ALGORITMO PCA %%%%%%%%%%
X=load('heart.txt');
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.

case 'Ninguno'
plot(handles.axes1,0);

guidata(hObject, handles);

case 'PCA'

[COEF, SCORE, LATENTE, TSQUARED] = princomp(X);
SCORE1=(SCORE(:,1));
SCORE2=(SCORE(:,2));

%%%%% Representacion vector PCA1 & PCA2

handles.SCORE1=SCORE1;
handles.SCORE2=SCORE2;
plot(handles.axes1,SCORE1,SCORE2,'*');
legend('PCA');
guidata(hObject, handles);

case 'MDS'

x=pdist(X);

[Y] = mdscale(x,2);

Y1=(Y(:,1));
Y2=(Y(:,2));

handles.Y1=Y1;
handles.Y2=Y2;
plot(handles.axes1,Y1,Y2,'*');
guidata(hObject, handles);
end


% --- Executes on button press in Realidad.
function Realidad_Callback(hObject, eventdata, handles)
% hObject handle to Realidad (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

warndlg('Joder, que bueno eres!!!','Curso_GUIDE');


% --- Executes when selected object is changed in opciones2.
function opciones2_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in opciones2
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)

X=load('heart.txt');
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.

case 'Ninguno2'

hold on
plot(handles.axes1,0);
hold off
guidata(hObject, handles);

case 'PCA2'

[COEF, SCOREb, LATENTE, TSQUARED] = princomp(X);
SCORE1b=(SCOREb(:,1));
SCORE2b=(SCOREb(:,2));

%%%%% Representacion vector PCA1 & PCA2

handles.SCORE1b=SCORE1b;
handles.SCORE2b=SCORE2b;
hold on
plot(handles.axes1,SCORE1b,SCORE2b,'or');
hold off
guidata(hObject, handles);

case 'MDS2'

x=pdist(X);

[Yb] = mdscale(x,2);

Y1b=(Yb(:,1));
Y2b=(Yb(:,2));

handles.Y1b=Y1b;
handles.Y2b=Y2b;
hold on
plot(handles.axes1,Y1b,Y2b,'or');
legend('MDS')
hold off
guidata(hObject, handles);
end
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de JESUS
Val: 3.309
Plata
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

limpiar grafica GUI

Publicado por JESUS (1818 intervenciones) el 26/04/2015 10:14:07
para borrar las gráficas :

1
cla('aquí va el nombre del ax','reset')


o

1
cla reset
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar