Matlab - Como quitar y poner una imagen el el mismo axes de un GUID

 
Vista:
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 27/03/2017 07:13:33
Buen dia.
Quiero cuando presione mi pushbot me carge una imagen, luego cuando cambie de opcion en mi pup menu y presionar nuevamente el pushbot me quite esa imagen y me cargue otra imagen diferente. como puedo hacer. Mi lo tengo asi:

1
2
3
4
5
6
7
8
switch Proceso
    case 'Evaporacion'
        img=imread('icv.png');
        imshow(img);
    case 'Condensacion'
        img=imread('icc.png');
        imshow(img);
end

pero cuando cambia de imagen me cierra el guid existente y abre uno nuevo solo con la imagen.
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 JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 27/03/2017 13:55:41
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function varargout = quitar_y_poner_imagen_en_un_axes(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @quitar_y_poner_imagen_en_un_axes_OpeningFcn, ...
                   'gui_OutputFcn',  @quitar_y_poner_imagen_en_un_axes_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end
 
if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
 
function quitar_y_poner_imagen_en_un_axes_OpeningFcn(hObject, eventdata, handles, varargin)
plot(1,1)
nombre1='ngc6543a.jpg';
nombre2= 'corn.tif';
set(handles.popupmenu1,'string',{nombre1,nombre2})
handles.nombre1=nombre1;
handles.output = hObject;
guidata(hObject, handles);
 
function varargout = quitar_y_poner_imagen_en_un_axes_OutputFcn(hObject, eventdata, handles)
set(handles.pushbutton1,'string', 'CARGAR IMAGEN')
varargout{1} = handles.output;
 
function pushbutton1_Callback(hObject, eventdata, handles)
nombre1=handles.nombre1;
imagen=imread(nombre1);
imshow(imagen)
 
function popupmenu1_Callback(hObject, eventdata, handles)
nombres=get(handles.popupmenu1,'string');
nombre1=nombres{get(hObject,'Value')} ;
handles.nombre1=nombre1;
guidata(hObject, handles);
% a=imread(imagen);
% imshow(a);


Saludos
JOSE JEREMIAS CABALLERO
Asesor de Proyectos con Matlab
Servicios de programación matlab


http://matlabcaballero.blogspot.com
https://www.facebook.com/matlabcaballero/
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
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 28/03/2017 09:01:53
Me sigue sacando del GUID y abriendo una nueva ventana, esto cuando cambio de imagen y presiono el boton.

Quisiera ver si se puede evitar eso, haciendo que en el mismo axes del GUID cambie la imagen sin cerrar el GUID.

Cuando cargo imagen1.png me marca un error, pero si cargo imagen2.jpg no me marca el error, el detalle es cuando quiero poner la imagen1.png, ahi cierra el GUID y cambia pone la imagen en otra ventana.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function prueba_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to prueba (see VARARGIN)
plot(1,1)
nombre1='imagen1.png';
nombre2='imagen2.jpg';
set(handles.popupmenu1,'string',{nombre1,nombre2})
handles.nombre=nombre1;
% Choose default command line output for prueba
handles.output = hObject;
 
% Update handles structure
guidata(hObject, handles);
 
% UIWAIT makes prueba wait for user response (see UIRESUME)
% uiwait(handles.figure1);
 
 
% --- Outputs from this function are returned to the command line.
function varargout = prueba_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.pushbutton1,'string','IMAGEN')
% Get default command line output from handles structure
varargout{1} = handles.output;
 
 
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
nombres=get(handles.popupmenu1,'string');
nombre1=nombres{get(hObject,'value')};
handles.nombre1=nombre1;
guidata(hObject,handles);
 
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
 
%a=imread(imagen);
%imshow(a);
 
% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
 
 
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
nombre1=handles.nombre1;
imagen=imread(nombre1);
imshow(imagen)
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
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 28/03/2017 09:26:36
2017-03-28


2017-03-28-1

2017-03-28-2
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
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 28/03/2017 14:09:05
El problema no es código sino la versión de matlab. Yo he hecho en una versión superior el código. Ese versión de matlab al parecer no reconoce la extensión png de una imagen.

Saludos
JOSE JEREMIAS CABALLERO
Asesor de Proyectos con Matlab
Servicios de programación matlab


http://matlabcaballero.blogspot.com
https://www.facebook.com/matlabcaballero/
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
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 28/03/2017 23:17:55
Entonces solo sería con .jpg nada más, habrá alguna sección aquí para descargar algún matlab más actualizado?
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
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 29/03/2017 03:41:43
Me vuelve a marcar error al seleccionar imagen1.jpg, solo si selecciono imagen2.jpg primero me la da, luego me vuelve a sacar del GUID cuando cambio a imagen2.jpg me saca del GUID y abre una ventana nueva. Sera problema de la versión de matlab?

1
2
3
4
5
plot(1,1)
nombre1='imagen1.jpg';
nombre2='imagen2.jpg';
set(handles.popupmenu1,'string',{nombre1,nombre2})
handles.nombre=nombre1;

2017-03-28
2017-03-28-4
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
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 29/03/2017 06:02:43
Ahi esta los dos archivos
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
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 29/03/2017 10:52:23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
function varargout = prueba(varargin)
% PRUEBA M-file for prueba.fig
%      PRUEBA, by itself, creates a new PRUEBA or raises the existing
%      singleton*.
%
%      H = PRUEBA returns the handle to a new PRUEBA or the handle to
%      the existing singleton*.
%
%      PRUEBA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in PRUEBA.M with the given input arguments.
%
%      PRUEBA('Property','Value',...) creates a new PRUEBA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before prueba_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to prueba_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help prueba

% Last Modified by GUIDE v2.5 28-Mar-2017 00:47:51

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @prueba_OpeningFcn, ...
                   'gui_OutputFcn',  @prueba_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before prueba is made visible.
function prueba_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to prueba (see VARARGIN)
plot(1,1)
nombre1='imagen1.jpg';
nombre2='imagen2.jpg';
set(handles.popupmenu1,'string',{nombre1,nombre2})
handles.nombre1=nombre1;
% Choose default command line output for prueba
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes prueba wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = prueba_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.pushbutton1,'string','IMAGEN')
% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
nombres=get(handles.popupmenu1,'string');
nombre1=nombres{get(hObject,'value')};
handles.nombre1=nombre1;
guidata(hObject,handles);
%a=imread(imagen);
%imshow(a);

% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called



% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
nombre1=handles.nombre1;
imagen=imread(nombre1);
imshow(imagen)
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
sin imagen de perfil

Como quitar y poner una imagen el el mismo axes de un GUID

Publicado por Alejandro (10 intervenciones) el 30/03/2017 09:33:04
No logro ver el cambio con respecto al programa que subi, no se si pudieras darme el dato
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