Matlab - Paso de parámetros de un subgui al programa principal

 
Vista:

Paso de parámetros de un subgui al programa principal

Publicado por Tony (3 intervenciones) el 05/07/2013 12:23:14
Buenos días

El programa consiste en que recojo unos datos mediante un edit_text y después de recoger estos datos y convertirlos en double, cuando los voy a pasar al menú principal resulta que me salta el siguiente error:

>> ??? Reference to non-existent field 'norte'.

De todas formas adjunto el programa y señalo donde esta el error en rojo. Debe ser una bobería pero es que no lo veo.

Gracias de antemano y sería genial si alguien pudiera ayudarme.


function varargout = menu_coordenadas(varargin)

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @menu_coordenadas_OpeningFcn, ...
'gui_OutputFcn', @menu_coordenadas_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

function menu_coordenadas_OpeningFcn(hObject, eventdata, handles, varargin)

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

mainFigureHandle = menu_principal; %stores the figure handle of Quan's GUI here
mainGUIdata = guidata(mainFigureHandle);

% Update handles structure
guidata(hObject, handles);

% --- Outputs from this function are returned to the command line.
function varargout = menu_coordenadas_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;


function oeste_h_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function oeste_h_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function este_h_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function este_h_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function sur_h_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function sur_h_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function norte_h_Callback(hObject, eventdata, handles)

% --- Executes during object creation, after setting all properties.
function norte_h_CreateFcn(hObject, eventdata, handles)
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)

norte = str2double(get(handles.norte_h, 'String'));
sur = str2double(get(handles.sur_h, 'String'));
oeste = str2double(get(handles.oeste_h, 'String'));
este = str2double(get(handles.este_h, 'String'));

if ((norte < sur) || (oeste > este) || (norte == sur) || (este == oeste))
msgbox('Por favor, introduzca unas coordenadas válidas.', 'Coordenadas incorrectas', 'warn');
elseif ((norte > 90) || (sur < -90) || (oeste < -180) || (este > 180))
msgbox('Por favor, introduzca unas coordenadas dentro del rango.', 'Coordenadas fuera de rango', 'warn');
else

% get the main_gui handle (access to the gui)
mainGUIhandle = menu_principal;
% get the data from the gui (all handles inside gui_main)
mainGUIdata = guidata(mainGUIhandle);

set(mainGUIdata.norte, 'String', get(handles.norte_h, 'String')); <<EL ERROR ES AQUÍ
set(mainGUIdata.sur, 'String', get(handles.sur_h, 'String'));
set(mainGUIdata.oeste, 'String', get(handles.oeste_h, 'String'));
set(mainGUIdata.este, 'String', get(handles.este_h, 'String'));

% save changed data back into main_gui
guidata(menu_principal, mainGUIdata);
close(menu_coordenadas);

end

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles

close(menu_coordenadas);
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

Paso de parámetros de un subgui al programa principal

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 05/07/2013 22:49:39
Al parecer el error está en el exportación de variables. Pero también veo este sentencia.
1
2
mainFigureHandle = menu_principal;
 mainGUIdata = guidata(mainFigureHandle);


No veo que tenga sentido. Bueno envíame tu guide tanto el *.fig y *.m para revisarlo y explica donde sacas las el
1
menú_principal
. Pues ver el error de un guide es no es tan fácil, depende de muchos factores.



Saludos.
JOSE JEREMÍAS CABALLERO
Asesorías en Matlab
programador en matlab
Servicios de programación matlab
[email protected]

http://matlabcaballero.blogspot.com

http://www.lawebdelprogramador.com/foros/Matlab/1371532-FORMA_DE_APRENDER_MATLAB.html
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