Problema inicializacion variables
Publicado por Jose Crespo (13 intervenciones) el 07/06/2012 20:00:53
Tengo un problema con la inicializacion de variables en la gude, porque en el OpeningFcn declaro globales unas variables yu las hago 0, pero despues una funcion de grafica, en funcion del valor de esas variables hace una cosa u otra. Lo que pasa es que cuando ejecuto el .fig me dice:
error:
Es decir que ejecuta priomero el axes2 y como aun no estan inicializadas las variables da error.
.m:
error:
plotear =
[]
grafica =
[]
procesado =
[]
??? Operands to the || and && operators must be convertible to logical scalar values.
Error in ==> procesado_gui>axes2_CreateFcn at 194
if plotear == 1 && procesado ==1;
[]
grafica =
[]
procesado =
[]
??? Operands to the || and && operators must be convertible to logical scalar values.
Error in ==> procesado_gui>axes2_CreateFcn at 194
if plotear == 1 && procesado ==1;
Es decir que ejecuta priomero el axes2 y como aun no estan inicializadas las variables da error.
.m:
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
% --- Executes just before procesado_gui is made visible.
function procesado_gui_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 procesado_gui (see VARARGIN)
handles.output = hObject;
global metodo coeficiente procesado niveles senal_ruidosa plotear grafica;
% Choose default command line output for procesado_gui
metodo='maxmin';
coeficiente = 'bior6.8';
niveles = '3 niveles';
senal_ruidosa = '0';
plotear=0;
grafica=0;
% Update handles structure
%handles.procesado=2
plot(0, 'Parent', handles.axes2);
guidata(hObject, handles);
% --- Outputs from this function are returned to the command line.
function varargout = procesado_gui_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;
% --- Executes during object creation, after setting all properties.
function axes2_CreateFcn(hObject, eventdata, handles)
global plotear qrs_fetal qrs_materno procesado grafica senal_ruidosa;
plotear
grafica
procesado
s=strcmp(senal_ruidosa,'0');
if plotear == 1 && procesado ==1;
switch (grafica)
case 1,
hold off;
plot(qrs_materno);
case 2,
hold off;
plot(qrs_fetal);
case 3,
plot(qrs_materno) ;
hold on;
plot(qrs_fetal);
otherwise
plot(0);
end
elseif plotear == 1 && procesado ==0 && s==0;
warndlg('No ha procesado la señal, pulse el botón procesar')
elseif plotear == 1 && procesado ==0 && s ~= 0
warndlg('No ha escogido ninguna señal, importe la señal a procesar')
else
plot(0);
end
Valora esta pregunta


0