Matlab - Problemas con selección de axes

 
Vista:
sin imagen de perfil
Val: 1
Ha aumentado su posición en 79 puestos en Matlab (en relación al último mes)
Gráfica de Matlab

Problemas con selección de axes

Publicado por Jose (1 intervención) el 02/07/2019 08:04:00
Hola tenga usted lector un cordial saludo. El asunto es que necesito hacer una interfaz gráfica interactiva en matlab (si, quizá no sea la mejor idea) y al momento de seleccionar un axes nuevo, lo que estaba haciendo en el axes anterioir, se sobreescribe con las nuevas instrucciones.

mi código es el siguiente:

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
120
121
122
123
124
125
126
127
function varargout = SOFTWARE_INTERACTIVO(varargin)
% SOFTWARE_INTERACTIVO MATLAB code for SOFTWARE_INTERACTIVO.fig
%      SOFTWARE_INTERACTIVO, by itself, creates a new SOFTWARE_INTERACTIVO or raises the existing
%      singleton*.
%
%      H = SOFTWARE_INTERACTIVO returns the handle to a new SOFTWARE_INTERACTIVO or the handle to
%      the existing singleton*.
%
%      SOFTWARE_INTERACTIVO('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SOFTWARE_INTERACTIVO.M with the given input arguments.
%
%      SOFTWARE_INTERACTIVO('Property','Value',...) creates a new SOFTWARE_INTERACTIVO or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before SOFTWARE_INTERACTIVO_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to SOFTWARE_INTERACTIVO_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

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

% Last Modified by GUIDE v2.5 01-Jul-2019 20:48:07

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @SOFTWARE_INTERACTIVO_OpeningFcn, ...
                   'gui_OutputFcn',  @SOFTWARE_INTERACTIVO_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 SOFTWARE_INTERACTIVO is made visible.
function SOFTWARE_INTERACTIVO_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 SOFTWARE_INTERACTIVO (see VARARGIN)

% Choose default command line output for SOFTWARE_INTERACTIVO
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

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

% --- Outputs from this function are returned to the command line.
function varargout = SOFTWARE_INTERACTIVO_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)

% Get default command line output from handles structure
varargout{1} = handles.output;

axes(handles.axes2);

 con=9;
    for i=1:1:17
        if(i<=9)
        d=num2str(i);
        file=(['martillo_h',d,'.jpg']);
        image=imread(file);
        b(i)=im2frame(image);
        elseif(i>=9)
        con=con-1;
        d=num2str(con);
        file=(['martillo_h',d,'.jpg']);
        image=imread(file);
        b(i)=im2frame(image);
        end
    end
    movie(b,20,10);
   


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

% Hint: get(hObject,'Value') returns toggle state of btn_Empezar
axes(handles.axes1);
con=9;
for i=1:1:17
    if(i<=9)
        d=num2str(i);
        file=(['martillo_load',d,'.jpg']);
        image=imresize(imread(file),0.44);
        c(i)=im2frame(image);
    elseif(i>=9)
        con=con-1;
        d=num2str(con);
        file=(['martillo_load',d,'.jpg']);
        image=(file);
        c(i)=im2frame(image);
    end
end
movie(c,20,7);

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

explico rapidito lo que hace. investigando descubrí que puedo hacer "gifs" en matlab con la func. movie entonces hago uno al inicio de la ejecución del GUIDE y el otro en teoria deberia iniciar cuando presiono el botón, pero en ves de que empiece en el axes seleccionado, empieza en el anterior. La cuestión es que el primer gif siempre tiene que estar en constante ejecución si no no tendría propósito lo que quiero hacer.
Ojalá y tenga solución el problema!

adjunto los archivos necesarios, para que se ejecuten
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