前提・実現したいこと
MATRABのGUIを使うときに.figが開かないようにしたいです。
独学でMATLABのGUI作成を始めた者です。
少々行き詰まってしまい質問させて頂きました。
どうかご教授の程よろしくお願いします。
発生している問題・エラーメッセージ
.m開くと、一緒に.figがGUIDEで開いてしまいます。
該当のソースコード
MATLAB
1function varargout = test003(varargin) 2% TEST003 MATLAB code for test003.fig 3% TEST003, by itself, creates a new TEST003 or raises the existing 4% singleton*. 5% 6% H = TEST003 returns the handle to a new TEST003 or the handle to 7% the existing singleton*. 8% 9% TEST003('CALLBACK',hObject,eventData,handles,...) calls the local 10% function named CALLBACK in TEST003.M with the given input arguments. 11% 12% TEST003('Property','Value',...) creates a new TEST003 or raises the 13% existing singleton*. Starting from the left, property value pairs are 14% applied to the GUI before test003_OpeningFcn gets called. An 15% unrecognized property name or invalid value makes property application 16% stop. All inputs are passed to test003_OpeningFcn via varargin. 17% 18% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 19% instance to run (singleton)". 20% 21% See also: GUIDE, GUIDATA, GUIHANDLES 22 23% Edit the above text to modify the response to help test003 24 25% Last Modified by GUIDE v2.5 07-Sep-2018 01:13:54 26 27% Begin initialization code - DO NOT EDIT 28gui_Singleton = 1; 29gui_State = struct('gui_Name', mfilename, ... 30 'gui_Singleton', gui_Singleton, ... 31 'gui_OpeningFcn', @test003_OpeningFcn, ... 32 'gui_OutputFcn', @test003_OutputFcn, ... 33 'gui_LayoutFcn', [] , ... 34 'gui_Callback', []); 35if nargin && ischar(varargin{1}) 36 gui_State.gui_Callback = str2func(varargin{1}); 37end 38 39if nargout 40 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 41else 42 gui_mainfcn(gui_State, varargin{:}); 43end 44% End initialization code - DO NOT EDIT 45 46 47% --- Executes just before test003 is made visible. 48function test003_OpeningFcn(hObject, eventdata, handles, varargin) 49% This function has no output args, see OutputFcn. 50% hObject handle to figure 51% eventdata reserved - to be defined in a future version of MATLAB 52% handles structure with handles and user data (see GUIDATA) 53% varargin command line arguments to test003 (see VARARGIN) 54 55% Choose default command line output for test003 56handles.output = hObject; 57 58% Update handles structure 59guidata(hObject, handles); 60 61% UIWAIT makes test003 wait for user response (see UIRESUME) 62% uiwait(handles.figure1); 63 64 65% --- Outputs from this function are returned to the command line. 66function varargout = test003_OutputFcn(hObject, eventdata, handles) 67% varargout cell array for returning output args (see VARARGOUT); 68% hObject handle to figure 69% eventdata reserved - to be defined in a future version of MATLAB 70% handles structure with handles and user data (see GUIDATA) 71 72% Get default command line output from handles structure 73varargout{1} = handles.output; 74 75 76% --- Executes on button press in radiobutton1. 77function radiobutton1_Callback(hObject, eventdata, handles) 78% hObject handle to radiobutton1 (see GCBO) 79% eventdata reserved - to be defined in a future version of MATLAB 80% handles structure with handles and user data (see GUIDATA) 81 82% Hint: get(hObject,'Value') returns toggle state of radiobutton1 83 84if (get(hObject,'Value') == get(hObject,'Max')) 85 display('Selected'); 86else 87 display('Not selected'); 88end 89
試したこと
試しに.figを削除したら、GUI自体起動しなくなりました。
補足情報(FW/ツールのバージョンなど)
MATLAB:R2018a(9.4.0.813654) 64-bit(maci64)
PC:MacBook Pro 2017
- バージョン:10.13.4(17E199)
- プロセッサ:2.3 GHz Intel Core i5
- メモリ:16 GB 2133 MHz LPDDR3
あなたの回答
tips
プレビュー