2013-08-15 5 views
4

현재 이미 완료 한 m.file 용 GUI를 개발 중입니다. GUI는 여러 페이지가있는 페이지가 될 것이며 각 페이지는 자신의 GUI가됩니다.MATLAB 다중 페이지 GUI 쿼리

마스터 GUI에서 사용자는 두 가지 옵션을 사용하여 라디오 버튼 그룹을 선택합니다. 선택 사항에 따라 페이지 순서는 마스터 GUI> GUI1> GUI2> GUI3 또는 마스터 GUI> GUI1> GUI4> GUI5가됩니다.

예를 들어 "http://matlabbyexamples.blogspot.sg/2011/10/multipages-gui-forms-combining-from.html"을 참조하면 어떻게 든 작동하고 페이지에서 페이지로 이동할 수 있습니다.

문제는 이제 마스터 GUI로 돌아와서 라디오 버튼 그룹에서 선택 사항을 변경하면 모든 GUI를 다시 열고 표시를 해제하여 다시 숨길 수 있다는 것입니다 (기본적으로 프로그램의 기능 내가 처음 열 때). 그것은 내가 원했던 것이 아니다. 새로운 MATLAB 사용자가 된 이유는 무엇입니까? 누군가가 나를 내가 뭘 잘못 알려주 수 있으며, 솔루션 날을 제공하는 경우

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

% Last Modified by GUIDE v2.5 14-Aug-2013 14:22:36 

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

% Choose default command line output for StartPage 
handles.output = hObject; 
handles.s1 = InitialCostCalculation; 
handles.s2 = PVSpecsInput; 
handles.s3 = PVSummary; 
handles.s4 = HybridSpecsInput; 
handles.s5 = HybridSummary; 

h1=guidata(handles.s1); 
h1.next = handles.s4; 
h1.prev = hObject; 
guidata(handles.s1,h1); 

h2=guidata(handles.s2); 
h2.next = handles.s3; 
h2.prev = handles.s1; 
guidata(handles.s2,h2); 

h3=guidata(handles.s3); 
h3.prev = handles.s2; 
guidata(handles.s3,h3); 

h4=guidata(handles.s4); 
h4.next = handles.s5; 
h4.prev = handles.s1; 
guidata(handles.s4,h4); 

h5=guidata(handles.s5); 
h5.prev = handles.s4; 
guidata(handles.s5,h5); 

% Update handles structure 
guidata(hObject, handles); 
handles.output; 

set(handles.s1,'Visible','off'); 
set(handles.s2,'Visible','off'); 
set(handles.s3,'Visible','off'); 
set(handles.s4,'Visible','off'); 
set(handles.s5,'Visible','off'); 
guidata(hObject, handles); 

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


% --- Outputs from this function are returned to the command line. 
function varargout = StartPage_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 Pg1Start_Button. 
function Pg1Start_Button_Callback(hObject, eventdata, handles) 
% hObject handle to Pg1Start_Button (see GCBO) 
% eventdata reserved - to be defined in a future version of MATLAB 
% handles structure with handles and user data (see GUIDATA) 
set(handles.output,'Visible','off'); 
set(handles.s1,'Visible','on'); 
set(handles.s2,'Visible','off'); 
set(handles.s3,'Visible','off'); 
set(handles.s4,'Visible','off'); 
set(handles.s5,'Visible','off'); 


% --- Executes when selected object is changed in MainMenu. 
function MainMenu_SelectionChangeFcn(hObject, eventdata, handles) 
% hObject handle to the selected object in MainMenu 
% eventdata structure with the following fields (see UIBUTTONGROUP) 
% EventName: string 'SelectionChanged' (read only) 
% OldValue: handle of the previously selected object or empty if none was selected 
% NewValue: handle of the currently selected object 
% handles structure with handles and user data (see GUIDATA) 
switch get(eventdata.NewValue,'Tag') 
    case 'PV_Button' 
     h1=guidata(handles.s1); 
     h1.next = handles.s2; 
     h1.prev = StartPage; 
     guidata(handles.s1,h1); 
    case 'Hybrid_Button' 
     h1=guidata(handles.s1); 
     h1.next = handles.s4; 
     h1.prev = StartPage; 
     guidata(handles.s1,h1); 
end 


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

내가 많이 감사하겠습니다 :

다음은 내 마스터 GUI의 코드 세그먼트입니다.

답변

1

gui의 마지막 변경 사항을 추적하는 다음 파일 교환 프로그램 (uiremember/uirestore)을 사용할 수 있습니다. 또한 figure_closeRequestFcn() (또는 반환 단추 콜백)을 here과 같이 "상태 저장"루틴으로 채우는 방법으로이 기능을 구현할 수 있습니다.

+0

내 문제를 다시 말하게하십시오. 위에서 게시 한 코드를 실행하면 다른 GUI 페이지가 모두 열리고 가시성이 "해제"되어 숨겨집니다. 그런 다음 PV 또는 하이브리드를 선택하고 원하는 GUI에 액세스 할 수 있습니다. 그러나 GUI를 닫지 않고 (뒤로 버튼을 사용할 수 있음) 다시 마스터 GUI로 돌아가서 다른 옵션을 선택하면 프로그램이 모든 GUI를 열어서 코드를 처음 실행했을 때와 마찬가지로 가시성을 숨길 수 있습니다. 나는 선택을 할 때마다 GUI를 열고 숨길 필요가 없다. –

+0

이 상황에서'if' 문이 도움이 될까요? 'if strcmp (get (handles.s1, 'Visible'), 'on') then then'입니다. – marsei

+0

그러면 나는 무엇을 비교할 것입니까? 나는 MATLAB GUI에 대해 정말 모릅니다. –