Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 08:40    
Titel : Rückgabewert einer GUI
 
 
 
 
Hallo, 
 
 
bitte um Hilfe, sehr dringend!!
 
leider finde ich im gesamten Forum nichts zu meinem Problem.
 
 
Ich möchte aus einer GUI (mit Textfeld) den Wert aus dem Textfeld zurückgeben. Problem ist sobald ich die Gui öffne gibt dieser die Werte gleich zurück. und nicht erst dann wenn ich auf den "bestätge Button" klicke.
 
 
Wichtig ist dabei das ganze ohne GUIDE zu lösen. Über hilfe wäre ich sehr dankbar) 
 
 
grüße
 
  
 
 
 
 
		
		 
		
		
		 
		 
		 
		
denny  
 
 
 
 
 
Supporter
  
 
 
 
 
 
 
Beiträge: 3.853 
 
 
 
 
 
 
Anmeldedatum: 14.02.08 
 
 
 
 
 
 
Wohnort: Ulm 
 
 
 
 
 
 
Version: R2012b 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 08:56    
Titel : 
 
 
 
 
Hallo, dann poste doch bitte schon, was du hast.
 
  
 
 
 
 
 
 Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 09:03    
Titel : 
 
 
 
 
  
 
           
 
	
	  	
		Code: 
		 
				
 
 
 
 
 
 
function   setIntlimit_callback( hObject, eventdata)  
 
 
 
    % interception of the user input errors  
 
    handles = guidata ( hObject) ; 
 
   
 
    % Comment  
 
    str_old = get ( handles.comment_field , 'String ') ; 
 
    str_old = 'please set   the Int time '; 
 
    set ( handles.comment_field ,'String ', str_old) ;  
 
     
 
     
 
        
 
     
 
%*********************************TEST************************************     
 
function   varargout   = USB4000_GUI_V3( varargin )  
 
     
 
    % Begin initialization code - DO NOT EDIT  
 
gui_Singleton = 1 ; 
 
gui_State = struct ( 'gui_Name ',       mfilename, ...   
 
                   'gui_Singleton ',  gui_Singleton, ...   
 
                   'gui_OpeningFcn ', @USB4000_GUI_V3_OpeningFcn, ...   
 
                   'gui_OutputFcn ',  @USB4000_GUI_V3_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   USB4000_GUI_V3_OpeningFcn( hObject, eventdata, handles, varargin )  
 
 
 
% Choose default command line output for gui_1  
 
handles.output  = hObject; 
 
 
 
% Update handles structure  
 
guidata ( hObject, handles) ; 
 
end   
 
 
 
 
 
function   varargout   = gui_1_OutputFcn( hObject, eventdata, handles)  
 
 
 
% Get default command line output from handles structure  
 
varargout { 1 }  = handles.output ; 
 
end   
 
 
 
input_data = { get ( handles.text1 ,'String ') } ; 
 
output = setInt( input_data) ; 
 
if   ~isempty ( output)  
 
   set ( handles.text1 ,'String ',output)  
 
end   
 
 
 
end   
 
 
 
%*********************************TEST************************************  
 
 
 
        
 
    % refresh the Handles  
 
    guidata ( hObject, handles) ;  
 
end   
 
 
 
 
 
 
 
 
 
 
Das ist ein Teil der HauptGUI, eigentlich sollte hier die GUI setINT sich öffnen... tut sich aber nix weder Fehlermeldung noch öffnet sich was
 
 
Grüße
 
  
 
 
 
 
 
denny  
 
 
 
 
 
Supporter
  
 
 
 
 
 
 
Beiträge: 3.853 
 
 
 
 
 
 
Anmeldedatum: 14.02.08 
 
 
 
 
 
 
Wohnort: Ulm 
 
 
 
 
 
 
Version: R2012b 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 09:12    
Titel : 
 
 
 
 
Hallo
 
verstehe ich richtig, du hast 2 GUIs?
 
 
 
USB4000_GUI_V3  ist dein Hauptfenster
 
setINT                  ist Nebenfenster
 
 
und du willst, dass setINT etwas zurückgibt?
 
  
 
 
 
 
 
denny  
 
 
 
 
 
Supporter
  
 
 
 
 
 
 
Beiträge: 3.853 
 
 
 
 
 
 
Anmeldedatum: 14.02.08 
 
 
 
 
 
 
Wohnort: Ulm 
 
 
 
 
 
 
Version: R2012b 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 09:39    
Titel : 
 
 
 
 
Okay, ich sehe dein File ist mit Nested Functions aufgebaut.
 
Hast du GUIDE benutzt oder wie hast du dein M-File geschrieben.
 
 
 
Habe jetzt ein wenig aufmerksamer dein Code durchgeschaut:
 
 
Unterschiede zwischen Definition und Aufruf von OutputFcn
 
kann zur Fehler Führen.
 
	
	  	
		Code: 
		 
				
 
 
gui_State = struct ( 'gui_Name ',       mfilename, ...   
 
                   'gui_Singleton ',  gui_Singleton, ...   
 
                   'gui_OpeningFcn ', @USB4000_GUI_V3_OpeningFcn, ...   
 
                   'gui_OutputFcn ',  @USB4000_GUI_V3_OutputFcn, ...   
 
                   'gui_LayoutFcn ',  [ ] , ...   
 
                   'gui_Callback ',   [ ] ) ;  
 
function   USB4000_GUI_V3_OpeningFcn( hObject, eventdata, handles, varargin )   
 
function   varargout   = gui_1_OutputFcn( hObject, eventdata, handles)   
 
gui_1_OutputFcn 
 
 
 
 
 
 
 
 
 
 
 
du verlangst ja schon beim Starten der Hauptfensters   die Rückgabe von setInt ( Achtung bei Nested Function musst beachten, zu welchem Zweig  die Aufrufe gehören, in diesem Fall gehört der untere Code zu USB4000_GUI_V3), 
 
 
Musste dass den nicht in ein Callback?
 
 
 
 
  
 
 
 
 
 
 Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 09:56    
Titel : 
 
 
 
 
  
 
           
 
Erstmal danke!
 
 
ne habe guide nicht benuzt habe mir aber fragmente von einem Funktionierendem Guide programm kopiert.. 
 
 
habe jetzt den code soweit abgeändert... aber die funktion setInt (also die GUI wird auch nicht gestartet.
 
 
es wird im commandwindow lediglich 780 ausgegeben, was die vordefinierte Integratiosgrenze von set int ist.  unten der Code von set int
 
 
	
	  	
		Code: 
		 
				
function   [ Int_up, Int_down]  = setInt( )  
 
%UNTITLED Summary of this function   goes here 
 
%   Detailed explanation goes here  
 
 
 
 
 
     
 
%% define mainwindow  
 
 
 
    mainWindow  =   figure ( ...   
 
                            'Units ','characters ',...   
 
                            'MenuBar ','none ',...   
 
                            'Toolbar ','none ',...   
 
                            'Resize ','off ',...   
 
                            'NumberTitle ','off ',...   
 
                            'Name ','set Integrallimits ',...   
 
                            'Units ','Pixels ','Position ',[ 530  130  300  300 ] ) ; 
 
                         
 
  
 
    handles.int_up      =        uicontrol ( 'parent ',mainWindow,'Style ','edit ',...   
 
                                          'String ','780  ',...   
 
                                          'backgroundcolor ',[ .99  .99  .99 ] , ...   
 
                                          'Enable ','on ',...   
 
                                          'Units ','Pixels ','Position ',[ 95  150  50  20 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ') ; 
 
                                       
 
    handles.int_down      =      uicontrol ( 'parent ',mainWindow,'Style ','edit ',...   
 
                                          'String ','380  ',...   
 
                                          'backgroundcolor ',[ .99  .99  .99 ] , ...   
 
                                          'Enable ','on ',...   
 
                                          'Units ','Pixels ','Position ',[ 80  50  50  20 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ') ; 
 
                                         
 
    handles.push_odc     =       uicontrol ( 'parent ',mainWindow,...   
 
                                          'Style ','pushbutton ',...   
 
                                          'String ','close ',...   
 
                                          'backgroundcolor ',[ .75  .75  .75 ] , ...   
 
                                          'Position ',[ 35  10  230  30 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'Enable ','on ',...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ',...   
 
                                          'TooltipString ','close the Window ',...   
 
                                          'Callback ',@close_callback) ; 
 
                                       
 
   handles.txt_ira  =            uicontrol ( 'parent ',mainWindow,'Style ','text ',...   
 
                                          'String ','set the Integrallimits for   irradiance calc. ',...   
 
                                          'backgroundcolor ',[ .80  .80  .8 ] , ...   
 
                                          'Position ',[ 15  180  280  20 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'HorizontalAlignment ','left ',...   
 
                                          'FontWeight ','bold ') ;                                    
 
                                       
 
               
 
%% Calculation  
 
 
 
    % read strings and convert to double and close  
 
    Int_up = str2double ( get ( handles.int_up , 'String ') ) ; 
 
    Int_down = str2double ( get ( handles.int_down , 'String ') ) ; 
 
     
 
    function   close_callback( hObject, eventdata, handles)  
 
     
 
        handles = guidata ( hObject) ;  
 
     
 
        Int_up = str2double ( get ( handles.int_up , 'String ') ) ; 
 
        Int_down = str2double ( get ( handles.int_down , 'String ') ) ; 
 
         
 
        % refresh the Handles  
 
        guidata ( hObject, handles) ;  
 
        close   
 
         
 
    end   
 
     
 
     
 
end   
 
 
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
 Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 10:14    
Titel : 
 
 
 
 
  
 
           
 
habe jetzt das programm noch etwas umgebaut ich schreibs nochmal rein.
 
- beim betätigen einens Buttons in GUI 1 wird die funktion setIntlimit_callback
 
ausgeführt dabei soll sich gui2 öffnen (machts aber nicht)
 
 
Code GUI1
 
 
	
	  	
		Code: 
		 
				
 
 
 
 
function   setIntlimit_callback( hObject, eventdata)  
 
 
 
    % interception of the user input errors  
 
    handles = guidata ( hObject) ; 
 
   
 
    % Comment  
 
    str_old = get ( handles.comment_field , 'String ') ; 
 
    str_old = 'please set   the Int time '; 
 
    set ( handles.comment_field ,'String ', str_old) ;  
 
     
 
 
 
function   varargout   = USB4000_GUI_V3( varargin )  
 
     
 
    % Begin initialization code - DO NOT EDIT  
 
gui_Singleton = 1 ; 
 
gui_State = struct ( 'gui_Name ',       mfilename, ...   
 
                   'gui_Singleton ',  gui_Singleton, ...   
 
                   'gui_OpeningFcn ', @USB4000_GUI_V3_OpeningFcn, ...   
 
                   'gui_OutputFcn ',  @USB4000_GUI_V3_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   USB4000_GUI_V3_OpeningFcn( hObject, eventdata, handles, varargin )  
 
 
 
% Choose default command line output for gui_1  
 
handles.output  = hObject; 
 
 
 
% Update handles structure  
 
guidata ( hObject, handles) ; 
 
end   
 
 
 
 
 
function   varargout   = USB4000_GUI_V3_OutputFcn( hObject, eventdata, handles)  
 
 
 
% Get default command line output from handles structure  
 
varargout { 1 }  = handles.output ; 
 
end   
 
 
 
input_data = { get ( handles.text1 ,'String ') } ; 
 
output = setInt( input_data) ; 
 
if   ~isempty ( output)  
 
   set ( handles.text1 ,'String ',output)  
 
end   
 
 
 
end   
 
 
 
    % refresh the Handles  
 
    guidata ( hObject, handles) ;  
 
end   
 
 
 
 
 
 
 
 
 
 
Nun sollen in GUI 2 eingaben gemacht werden, und an GUI 1  zurückgeben werden, geht leider auch nicht ;( 
 
 
Code GUI2
 
 
	
	  	
		Code: 
		 
				
 
 
function   varargout   = setInt( varargin )  
 
%UNTITLED Summary of this function   goes here 
 
%   Detailed explanation goes here  
 
 
 
 
 
     
 
%% define mainwindow  
 
 
 
    mainWindow  =   figure ( ...   
 
                            'Units ','characters ',...   
 
                            'MenuBar ','none ',...   
 
                            'Toolbar ','none ',...   
 
                            'Resize ','off ',...   
 
                            'NumberTitle ','off ',...   
 
                            'Name ','set Integrallimits ',...   
 
                            'Units ','Pixels ','Position ',[ 530  130  300  300 ] ) ; 
 
                         
 
  
 
    handles.int_up      =        uicontrol ( 'parent ',mainWindow,'Style ','edit ',...   
 
                                          'String ','780  ',...   
 
                                          'backgroundcolor ',[ .99  .99  .99 ] , ...   
 
                                          'Enable ','on ',...   
 
                                          'Units ','Pixels ','Position ',[ 95  150  50  20 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ',...   
 
                                          'Callback ',@edit1_callback) ; 
 
                                       
 
    handles.int_down      =      uicontrol ( 'parent ',mainWindow,'Style ','edit ',...   
 
                                          'String ','380  ',...   
 
                                          'backgroundcolor ',[ .99  .99  .99 ] , ...   
 
                                          'Enable ','on ',...   
 
                                          'Units ','Pixels ','Position ',[ 80  50  50  20 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ',...   
 
                                          'Callback ',@edit2_callback) ; 
 
                                         
 
    handles.push_odc     =       uicontrol ( 'parent ',mainWindow,...   
 
                                          'Style ','pushbutton ',...   
 
                                          'String ','close ',...   
 
                                          'backgroundcolor ',[ .75  .75  .75 ] , ...   
 
                                          'Position ',[ 35  10  230  30 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'Enable ','on ',...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ',...   
 
                                          'TooltipString ','close the Window ',...   
 
                                          'Callback ',@close_callback) ; 
 
                                       
 
   handles.txt_ira  =            uicontrol ( 'parent ',mainWindow,'Style ','text ',...   
 
                                          'String ','set the Integrallimits for   irradiance calc. ',...   
 
                                          'backgroundcolor ',[ .80  .80  .8 ] , ...   
 
                                          'Position ',[ 15  180  280  20 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'HorizontalAlignment ','left ',...   
 
                                          'FontWeight ','bold ') ;                                    
 
                                       
 
 
 
     
 
    %% Init  
 
     
 
    % Begin initialization code - DO NOT EDIT  
 
gui_Singleton = 1 ; 
 
gui_State = struct ( 'gui_Name ',       mfilename, ...   
 
                   'gui_Singleton ',  gui_Singleton, ...   
 
                   'gui_OpeningFcn ', @setInt_OpeningFcn, ...   
 
                   'gui_OutputFcn ',  @setInt_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   setInt_OpeningFcn( hObject, eventdata, handles, varargin )  
 
 
 
    input_data = varargin { 1 } ; 
 
 
 
set ( handles.int_up ,'String ',input_data{ 1 } )  
 
set ( handles.int_down ,'String ',input_data{ 2 } )  
 
 
 
% Choose default command line output for gui_2  
 
handles.output  = hObject; 
 
% Update handles structure  
 
guidata ( hObject, handles) ; 
 
end   
 
 
 
 
 
 
 
function   varargout   = setInt_OutputFcn( hObject, eventdata, handles)  
 
 
 
uiwait( handles.figure1 ) ; 
 
 
 
if   ~ishandle ( handles.figure1 )  
 
   % falls durch 'X' - liefert die Funktion en [] zurück  
 
   varargout { 1 }  = [ ] ; 
 
else   
 
   % handles updaten (für den "output")  
 
   handles = guidata ( handles.figure1 ) ; 
 
   varargout { 1 }  = handles.output ; 
 
   delete ( handles.figure1 )     
 
end   
 
 
 
function   edit1_callback( hObject, eventdata, handles)  
 
end   
 
function   edit2_callback( hObject, eventdata, handles)  
 
end   
 
 
 
function   close_callback_Callback( hObject, eventdata, handles)  
 
 
 
output = get ( handles.edit1 ,'String ') ; 
 
 
 
handles.output  = output; 
 
% handles struktur abspeichern.  
 
guidata ( handles.figure1 ,handles) ; 
 
% 
 
% anschliessend wird die UIWAIT aufgehoben  
 
uiresume  ; 
 
 
 
end   
 
end   
 
end   
 
 
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
denny  
 
 
 
 
 
Supporter
  
 
 
 
 
 
 
Beiträge: 3.853 
 
 
 
 
 
 
Anmeldedatum: 14.02.08 
 
 
 
 
 
 
Wohnort: Ulm 
 
 
 
 
 
 
Version: R2012b 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 10:48    
Titel : 
 
 
 
 
Hallo
 
bin etwas zu faul jetzt in Code einzulesen, kannst du vielleicht die Files anhängen, FIG- und M-Files, um selbst zu testen.
 
  
 
 
 
 
 
 Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 10:50    
Titel : 
 
 
 
 
Hallo hab leider keine . fig dateien, ich 
 
definier die GUI immer am anfang. (siehe Gui2)
 
 
hoffe kansnt mir trotzdem helfen.
 
  
 
 
 
 
 
denny  
 
 
 
 
 
Supporter
  
 
 
 
 
 
 
Beiträge: 3.853 
 
 
 
 
 
 
Anmeldedatum: 14.02.08 
 
 
 
 
 
 
Wohnort: Ulm 
 
 
 
 
 
 
Version: R2012b 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 12:06    
Titel : 
 
 
 
 
Aber für Haupt GUI habe ich keine Definition?
 
  
 
 
 
 
 
 Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 13:08    
Titel : 
 
 
 
 
  
 
           
 
Anbei die Definition
 
 
Danke für deine Hilfe
 
 
	
	  	
		Code: 
		 
				
 
 
 
 
% function USB4000_GUI_V3  
 
function   varargout   = USB4000_GUI_V3( varargin )  
 
 
 
%************************************************************************** 
 
%% definition of the mainwindow  
 
%************************************************************************** 
 
 
 
    % mainwindow  
 
    mainWindow  =   figure ( ...   
 
                            'Units ','characters ',...   
 
                            'MenuBar ','none ',...   
 
                            'Toolbar ','none ',...   
 
                            'Resize ','off ',...   
 
                            'NumberTitle ','off ',...   
 
                            'Name ','USB4000_GUI ',...   
 
                            'Units ','Pixels ','Position ',[ 50  50  1070  650 ] ) ; 
 
                            %Postion: ( from left, from below, width, high in Pixel)  
 
 
 
 
 
%**************************************************************************                         
 
%% Panel for Spectrometer Analysis "Analysis"  
 
%************************************************************************** 
 
 
 
    Analysis    =   uipanel ( 'parent ',mainWindow,...   
 
                            'Title ','Analysis ',...   
 
                            'Fontsize ',8 ,...   
 
                            'FontWeight ','bold ',...   
 
                            'TitlePosition ','lefttop ',...   
 
                            'Units ','Pixels ','Position ',[ 20  20  250  200 ] ) ;  
 
 
 
 
 
%************************************************************************** 
 
%% Analysis   
 
%************************************************************************** 
 
 
 
 
 
    % set int  
 
    handles.push_SetIntphi     = uicontrol ( 'parent ',Analysis,...   
 
                                          'Style ','pushbutton ',...   
 
                                          'String ','integrallimits ',...   
 
                                          'backgroundcolor ',[ .75  .75  .75 ] , ...   
 
                                          'Position ',[ 5  150  100  30 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'Enable ','on ',...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ',...   
 
                                          'TooltipString ','choose the Integrallimits ',...   
 
                                          'Callback ',@setIntlimit_callback) ;  
 
    
 
                                              
 
guidata ( mainWindow,handles) ;       
 
end   
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
denny  
 
 
 
 
 
Supporter
  
 
 
 
 
 
 
Beiträge: 3.853 
 
 
 
 
 
 
Anmeldedatum: 14.02.08 
 
 
 
 
 
 
Wohnort: Ulm 
 
 
 
 
 
 
Version: R2012b 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 14:11    
Titel : 
 
 
 
 
  
 
           
 
So sollte setInt aussehen 
 
 
	
	  	
		Code: 
		 
				
 
 
function   varargout   = setInt( varargin )  
 
%UNTITLED Summary of this function   goes here 
 
%   Detailed explanation goes here  
 
 
 
handles = init_gui( ) ; 
 
 
 
if   nargin  ~=0     
 
   input_data = varargin { 1 } ; 
 
    
 
   set ( handles.int_up ,'String ',input_data{ 1 } )  
 
   set ( handles.int_down ,'String ',input_data{ 2 } )  
 
end   
 
 
 
uiwait( handles.mainWindow )  
 
 
 
varargout { 1 }  = str2double ( get ( handles.int_up ,  'String ') ) ; 
 
varargout { 2 }  = str2double ( get ( handles.int_down ,'String ') ) ; 
 
 
 
if   ishandle ( handles.mainWindow )  
 
  delete ( handles.mainWindow )  
 
end   
 
 
 
 
 
function   handles = init_gui( )  
 
 
 
mainWindow  =   figure ( ...   
 
   'Units ','characters ',...   
 
   'MenuBar ','none ',...   
 
   'Toolbar ','none ',...   
 
   'Resize ','off ',...   
 
   'NumberTitle ','off ',...   
 
   'Name ','set integral   limits ',...   
 
   'Units ','Pixels ','Position ',[ 530  130  300  300 ] ) ; 
 
handles.mainWindow  =  mainWindow; 
 
handles.int_up      =  uicontrol ( ...   
 
   'parent ',mainWindow,'Style ','edit ',...   
 
   'String ','780  ',...   
 
   'backgroundcolor ',[ .99  .99  .99 ] , ...   
 
   'Enable ','on ',...   
 
   'Units ','Pixels ','Position ',[ 95  150  50  20 ] ,...   
 
   'FontSize ',10 ,...   
 
   'HorizontalAlignment ','center ',...   
 
   'FontWeight ','bold ') ; 
 
 
 
handles.int_down     =  uicontrol ( ...   
 
   'parent ',mainWindow,'Style ','edit ',...   
 
   'String ','380  ',...   
 
   'backgroundcolor ',[ .99  .99  .99 ] , ...   
 
   'Enable ','on ',...   
 
   'Units ','Pixels ','Position ',[ 80  50  50  20 ] ,...   
 
   'FontSize ',10 ,...   
 
   'HorizontalAlignment ','center ',...   
 
   'FontWeight ','bold ') ; 
 
 
 
handles.push_odc     =  uicontrol ( ...   
 
   'parent ',mainWindow,...   
 
   'Style ','pushbutton ',...   
 
   'String ','close ',...   
 
   'backgroundcolor ',[ .75  .75  .75 ] , ...   
 
   'Position ',[ 35  10  230  30 ] ,...   
 
   'FontSize ',10 ,...   
 
   'Enable ','on ',...   
 
   'HorizontalAlignment ','center ',...   
 
   'FontWeight ','bold ',...   
 
   'TooltipString ','close the Window ') ; 
 
 
 
handles.txt_ira  =     uicontrol ( ...   
 
   'parent ',mainWindow,'Style ','text ',...   
 
   'String ','set the integral   limits for   irradiance calc. ',...   
 
   'backgroundcolor ',[ .80  .80  .8 ] , ...   
 
   'Position ',[ 15  180  280  20 ] ,...   
 
   'FontSize ',10 ,...   
 
   'HorizontalAlignment ','left ',...   
 
   'FontWeight ','bold ') ; 
 
guidata ( mainWindow,handles) ;    
 
 
 
set ( handles.int_up ,     'Callback ',  { @edit1_callback, guidata ( mainWindow) } ) ; 
 
set ( handles.mainWindow , 'CloseRequestFcn ',{ @close_gui, guidata ( mainWindow) } ) ; 
 
set ( handles.int_down ,   'Callback ',  { @edit2_callback, guidata ( mainWindow) } ) ; 
 
set ( handles.push_odc ,   'Callback ',       { @close_gui, guidata ( mainWindow) } ) ; 
 
 
 
 
 
function   edit1_callback( hObject, eventdata, handles)  
 
 
 
%   
 
function   edit2_callback( hObject, eventdata, handles)  
 
 
 
 
 
function   close_gui( hObject, eventdata, handles)  
 
uiresume ( handles.mainWindow )  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Haupt GUI nur zum testen
 
	
	  	
		Code: 
		 
				
 
 
 
 
% function USB4000_GUI_V3  
 
function   varargout   = USB4000_GUI_V3( varargin )  
 
 
 
%************************************************************************** 
 
%% definition of the mainwindow  
 
%************************************************************************** 
 
 
 
    % mainwindow  
 
    mainWindow  =   figure ( ...   
 
                            'Units ','characters ',...   
 
                            'MenuBar ','none ',...   
 
                            'Toolbar ','none ',...   
 
                            'Resize ','off ',...   
 
                            'NumberTitle ','off ',...   
 
                            'Name ','USB4000_GUI ',...   
 
                            'Units ','Pixels ','Position ',[ 50  50  1070  650 ] ) ; 
 
                            %Postion: ( from left, from below, width, high in Pixel)  
 
 
 
 
 
%**************************************************************************                         
 
%% Panel for Spectrometer Analysis "Analysis"  
 
%************************************************************************** 
 
 
 
    Analysis    =   uipanel ( 'parent ',mainWindow,...   
 
                            'Title ','Analysis ',...   
 
                            'Fontsize ',8 ,...   
 
                            'FontWeight ','bold ',...   
 
                            'TitlePosition ','lefttop ',...   
 
                            'Units ','Pixels ','Position ',[ 20  20  250  200 ] ) ; 
 
 
 
 
 
%************************************************************************** 
 
%% Analysis  
 
%************************************************************************** 
 
 
 
 
 
    % set int  
 
    handles.push_SetIntphi     = uicontrol ( 'parent ',Analysis,...   
 
                                          'Style ','pushbutton ',...   
 
                                          'String ','integrallimits ',...   
 
                                          'backgroundcolor ',[ .75  .75  .75 ] , ...   
 
                                          'Position ',[ 5  150  100  30 ] ,...   
 
                                          'FontSize ',10 ,...   
 
                                          'Enable ','on ',...   
 
                                          'HorizontalAlignment ','center ',...   
 
                                          'FontWeight ','bold ',...   
 
                                          'TooltipString ','choose the Integrallimits ',...   
 
                                          'Callback ',@setIntlimit_callback) ; 
 
    
 
                                              
 
guidata ( mainWindow,handles) ;       
 
 
 
 
 
 
 
 
 
function   setIntlimit_callback( hObject, eventdata)  
 
 
 
 
 
[ v1, v2]  = setInt( ) ; 
 
 
 
fprintf ( 'Werte: v1=%d und v2=%d\n ',v1,v2)  
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
 Gast 
 
 
 
 
  
 
 
 
 
 
Beiträge: --- 
 
 
 
 
 
 
Anmeldedatum: --- 
 
 
 
 
 
 
Wohnort: --- 
 
 
 
 
 
 
Version: --- 
 
 
 
 
 
 
 
 
 
 
      
Verfasst am : 25.06.2010, 16:03    
Titel : 
 
 
 
 
super hat einwandfrei funktioniert, konnte es ohne probleme implementieren.
 
 
Vielen DANK!!!!!
 
  
 
 
 
 
 
 
 
 
 
 
 
 
Einstellungen und Berechtigungen
 
 
 
 
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 
 
 
 
  
 
  Impressum 
 | Nutzungsbedingungen 
 | Datenschutz 
 | FAQ 
 |   RSS 
   
  Hosted by:  
 
   
Copyright © 2007 - 2025
goMatlab.de  | Dies ist keine offizielle Website der Firma The Mathworks  
 
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.