Verfasst am: 12.08.2017, 20:44
Titel: Wert aus GUI-Funktion im Hauptprogramm verwenden
Hallo,
ich habe folgendes Problem, an dem ich nun Stunden sitze.
Ich möchte in einem GUI-Fenster ein Bild (unter axes angezeigt) aussuchen und je nach Bild den Wert map = 1, 2 oder 3 speichern, damit ich es im Hauptprogramm weiter verwenden kann.
% MAPAUSWAHL MATLAB code for MapAuswahl.fig % MAPAUSWAHL, by itself, creates a new MAPAUSWAHL or raises the existing % singleton*.
%
% H = MAPAUSWAHL returns the handle to a new MAPAUSWAHL or the handle to % the existing singleton*.
%
% MAPAUSWAHL('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in MAPAUSWAHL.M with the given input arguments.
%
% MAPAUSWAHL('Property','Value',...) creates a new MAPAUSWAHL or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before MapAuswahl_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to MapAuswahl_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 MapAuswahl
% Last Modified by GUIDE v2.5 12-Aug-2017 21:18:56
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @MapAuswahl_OpeningFcn, ...
'gui_OutputFcn', @MapAuswahl_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
ifnargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
% --- Executes just before MapAuswahl is made visible. function MapAuswahl_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 MapAuswahl (see VARARGIN)
% Choose default command line output for MapAuswahl
handles.output = hObject;
% UIWAIT makes MapAuswahl wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. functionvarargout = MapAuswahl_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 on button press in map1. function map1_Callback(hObject, eventdata, handles,mapWahl) % hObject handle to map1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
mapWahl = 1;
% Hint: get(hObject,'Value') returns toggle state of map1
% --- Executes on button press in map2. function map2_Callback(hObject, eventdata, handles,mapWahl) % hObject handle to map2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
mapWahl = 2;
% Hint: get(hObject,'Value') returns toggle state of map2
% --- Executes on button press in map3. function map3_Callback(hObject, eventdata, handles,mapWahl) % hObject handle to map3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global mapWahl;
mapWahl = 3;
% Hint: get(hObject,'Value') returns toggle state of map3
% --- Executes on button press in weiter. function weiter_Callback(hObject, eventdata, handles, mapWahl) % hObject handle to weiter (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
Du kannst Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen. Du kannst Dateien in diesem Forum posten Du kannst Dateien in diesem Forum herunterladen
MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.