【问题标题】:How to select a file through a GUI in MATLAB如何在 MATLAB 中通过 GUI 选择文件
【发布时间】:2012-03-30 06:52:49
【问题描述】:

我想创建一个 GUI,以便在单击标题为“选择图像”的按钮时将图像文件复制到 matlab 工作区。它应该提示我从给定文件夹中选择特定图像,然后单击标题为“运行”的按钮,应该运行一个 m 文件(我已经编写)并显示输出。

有人可以在这方面帮助我吗?

【问题讨论】:

    标签: matlab user-interface


    【解决方案1】:

    看看这个:

    http://www.mathworks.de/help/techdoc/ref/uigetfile.html

    在 MATLAB 中创建 GUI 非常简单。在命令行中键入“guide”,以图形方式添加您的按钮,然后用您需要的代码填充这些按钮的回调函数。

    【讨论】:

      【解决方案2】:

      整个答案可能有点长,但我们还是试试吧

      正如之前的海报所推荐的,使用guide 命令开始设计GUI。 添加一些按钮。右键单击按钮将为您提供“按钮回调函数”,每当您在运行的 GUI 上按下按钮时都会调用该函数。

      重要的命令是:

      BUTTON1:在 Matlab 的 GUI 中通过模式对话框读取图像

      并将图像数据放入基础工作区中的变量 X 和映射

      % --- Executes on button press in pushbutton1.
      function pushbutton1_Callback(hObject, eventdata, handles)
      disp('Load image button pressed ...')
      %% Create a file dialog for images
      [filename, user_cancelled] = imgetfile;
          if user_cancelled
                  disp('User pressed cancel')
          else
                  disp(['User selected ', filename])
          end
      
          %% Read the selected image into the variable
          disp('Reading the image into variable X');
          [X,map] = imread(filename);
          %% Copy X and map to base workspace, overwriting the content !!!
          assignin('base','X',X); 
          assignin('base','map',map); 
          %% Now you have X and map variables in the base workspace
      

      BUTTON2:运行自定义命令

      在基本工作区中对 X 和映射变量做一些事情

      % --- Executes on button press in pushbutton2.
      function pushbutton2_Callback(hObject, eventdata, handles)
      % hObject    handle to pushbutton2 (see GCBO)
      % eventdata  reserved - to be defined in a future version of MATLAB
      % handles    structure with handles and user data (see GUIDATA)
      
      %% Put your own code here to be called
      disp('Run button pressed ...')
      evalin('base', 'if exist(''X'', ''var''), disp(''image loaded into X''), else, disp(''image not loaded yet''), end');
      % if exist('X', 'var'), disp('image loaded into X'), else, disp('image not loaded yet'), end)
      

      或者,您可以在 matlab 中创建自己的文件对话框:

      %% Alternatively use the following for reading image files of your own choosing
      [filename, pathname] = uigetfile({'*.jpg;*.png;*.gif;*.bmp', 'All Image Files (*.jpg, *.png, *.gif, *.bmp)'; ...
                      '*.*',                   'All Files (*.*)'}, ...
                      'Pick an image file');
      
      %This code checks if the user pressed cancel on the dialog.
              if isequal(filename,0) || isequal(pathname,0)
                   disp('User pressed cancel')
              else
                   disp(['User selected ', fullfile(pathname, filename)])
      
              end
      

      这是整个文件的工作,只需复制和粘贴:

          function varargout = guitutorial_export(varargin)
          % GUITUTORIAL_EXPORT M-file for guitutorial_export.fig
          %      GUITUTORIAL_EXPORT, by itself, creates a new GUITUTORIAL_EXPORT or raises the existing
          %      singleton*.
          %
          %      H = GUITUTORIAL_EXPORT returns the handle to a new GUITUTORIAL_EXPORT or the handle to
          %      the existing singleton*.
          %
          %      GUITUTORIAL_EXPORT('CALLBACK',hObject,eventData,handles,...) calls the local
          %      function named CALLBACK in GUITUTORIAL_EXPORT.M with the given input arguments.
          %
          %      GUITUTORIAL_EXPORT('Property','Value',...) creates a new GUITUTORIAL_EXPORT or raises the
          %      existing singleton*.  Starting from the left, property value pairs are
          %      applied to the GUI before guitutorial_export_OpeningFcn gets called.  An
          %      unrecognized property name or invalid value makes property application
          %      stop.  All inputs are passed to guitutorial_export_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 guitutorial_export
      
          % Last Modified by GUIDE v2.5 01-Apr-2012 00:26:11
      
          % Begin initialization code - DO NOT EDIT
          gui_Singleton = 1;
          gui_State = struct('gui_Name',       mfilename, ...
                                               'gui_Singleton',  gui_Singleton, ...
                                               'gui_OpeningFcn', @guitutorial_export_OpeningFcn, ...
                                               'gui_OutputFcn',  @guitutorial_export_OutputFcn, ...
                                               'gui_LayoutFcn',  @guitutorial_export_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 guitutorial_export is made visible.
          function guitutorial_export_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 guitutorial_export (see VARARGIN)
      
          % Choose default command line output for guitutorial_export
          handles.output = hObject;
      
          % Update handles structure
          guidata(hObject, handles);
      
          % UIWAIT makes guitutorial_export wait for user response (see UIRESUME)
          % uiwait(handles.figure1);
      
      
          % --- Outputs from this function are returned to the command line.
          function varargout = guitutorial_export_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 pushbutton1.
          function pushbutton1_Callback(hObject, eventdata, handles)
          % hObject    handle to pushbutton1 (see GCBO)
          % eventdata  reserved - to be defined in a future version of MATLAB
          % handles    structure with handles and user data (see GUIDATA)
      
          disp('Load image button pressed ...')
      
          %% Alternatively use the following for reading image files of your own choosing
          % [filename, pathname] = uigetfile({'*.jpg;*.png;*.gif;*.bmp', 'All Image Files (*.jpg, *.png, *.gif, *.bmp)'; ...
          %         '*.*',                   'All Files (*.*)'}, ...
          %         'Pick an image file');
          %       
          % %This code checks if the user pressed cancel on the dialog.
          %     if isequal(filename,0) || isequal(pathname,0)
          %        disp('User pressed cancel')
          %     else
          %        disp(['User selected ', fullfile(pathname, filename)])
          %            
          %       end
      
          [filename, user_cancelled] = imgetfile;
                  if user_cancelled
                          disp('User pressed cancel')
                  else
                          disp(['User selected ', filename])
                  end
      
          %% Read the selected image into the variable
          disp('Reading the image into variable X');
          [X,map] = imread(filename);
          %% Copy X and map to base workspace, overwriting the content !!!
          assignin('base','X',X); 
          assignin('base','map',map); 
          %% 
      
      
          % --- Executes on button press in pushbutton2.
          function pushbutton2_Callback(hObject, eventdata, handles)
          % hObject    handle to pushbutton2 (see GCBO)
          % eventdata  reserved - to be defined in a future version of MATLAB
          % handles    structure with handles and user data (see GUIDATA)
      
          %% Put your own code here to be called
          disp('Run button pressed ...')
          evalin('base', 'if exist(''X'', ''var''), disp(''image loaded into X''), else, disp(''image not loaded yet''), end');
          % if exist('X', 'var'), disp('image loaded into X'), else, disp('image not loaded yet'), end)
      
      
      
          % --- Creates and returns a handle to the GUI figure. 
          function h1 = guitutorial_export_LayoutFcn(policy)
          % policy - create a new figure or use a singleton. 'new' or 'reuse'.
      
          persistent hsingleton;
          if strcmpi(policy, 'reuse') & ishandle(hsingleton)
                  h1 = hsingleton;
                  return;
          end
      
          appdata = [];
          appdata.GUIDEOptions = struct(...
                  'active_h', [], ...
                  'taginfo', struct(...
                  'figure', 2, ...
                  'pushbutton', 3), ...
                  'override', 0, ...
                  'release', 13, ...
                  'resize', 'none', ...
                  'accessibility', 'callback', ...
                  'mfile', 1, ...
                  'callbacks', 1, ...
                  'singleton', 1, ...
                  'syscolorfig', 1, ...
                  'blocking', 0, ...
                  'lastSavedFile', '/home/mosi/Documents/MATLAB/guitutorial_export.m', ...
                  'lastFilename', '/home/mosi/Documents/MATLAB/guitutorial.fig');
          appdata.lastValidTag = 'figure1';
          appdata.GUIDELayoutEditor = [];
          appdata.initTags = struct(...
                  'handle', [], ...
                  'tag', 'figure1');
      
          h1 = figure(...
          'Units','characters',...
          'Color',[0.701960784313725 0.701960784313725 0.701960784313725],...
          'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
          'IntegerHandle','off',...
          'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
          'MenuBar','none',...
          'Name','guitutorial',...
          'NumberTitle','off',...
          'PaperPosition',get(0,'defaultfigurePaperPosition'),...
          'Position',[103.833333333333 29.1333333333333 112 32.3333333333333],...
          'Resize','off',...
          'HandleVisibility','callback',...
          'Tag','figure1',...
          'UserData',[],...
          'Visible','on',...
          'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
      
          appdata = [];
          appdata.lastValidTag = 'pushbutton1';
      
          h2 = uicontrol(...
          'Parent',h1,...
          'Units','characters',...
          'Callback',@(hObject,eventdata)guitutorial_export('pushbutton1_Callback',hObject,eventdata,guidata(hObject)),...
          'Position',[8.16666666666667 27.5333333333333 25.1666666666667 1.4],...
          'String','Select image',...
          'Tag','pushbutton1',...
          'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
      
          appdata = [];
          appdata.lastValidTag = 'pushbutton2';
      
          h3 = uicontrol(...
          'Parent',h1,...
          'Units','characters',...
          'Callback',@(hObject,eventdata)guitutorial_export('pushbutton2_Callback',hObject,eventdata,guidata(hObject)),...
          'Position',[8.16666666666667 24.8 11.6666666666667 1.4],...
          'String','Run',...
          'Tag','pushbutton2',...
          'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
      
      
          hsingleton = h1;
      
      
          % --- Set application data first then calling the CreateFcn. 
          function local_CreateFcn(hObject, eventdata, createfcn, appdata)
      
          if ~isempty(appdata)
               names = fieldnames(appdata);
               for i=1:length(names)
                       name = char(names(i));
                       setappdata(hObject, name, getfield(appdata,name));
               end
          end
      
          if ~isempty(createfcn)
               if isa(createfcn,'function_handle')
                       createfcn(hObject, eventdata);
               else
                       eval(createfcn);
               end
          end
      
      
          % --- Handles default GUIDE GUI creation and callback dispatch
          function varargout = gui_mainfcn(gui_State, varargin)
      
          gui_StateFields =  {'gui_Name'
                  'gui_Singleton'
                  'gui_OpeningFcn'
                  'gui_OutputFcn'
                  'gui_LayoutFcn'
                  'gui_Callback'};
          gui_Mfile = '';
          for i=1:length(gui_StateFields)
                  if ~isfield(gui_State, gui_StateFields{i})
                          error('MATLAB:gui_mainfcn:FieldNotFound', 'Could not find field %s in the gui_State struct in GUI M-file %s', gui_StateFields{i}, gui_Mfile);
                  elseif isequal(gui_StateFields{i}, 'gui_Name')
                          gui_Mfile = [gui_State.(gui_StateFields{i}), '.m'];
                  end
          end
      
          numargin = length(varargin);
      
          if numargin == 0
                  % GUITUTORIAL_EXPORT
                  % create the GUI only if we are not in the process of loading it
                  % already
                  gui_Create = true;
          elseif local_isInvokeActiveXCallback(gui_State, varargin{:})
                  % GUITUTORIAL_EXPORT(ACTIVEX,...)
                  vin{1} = gui_State.gui_Name;
                  vin{2} = [get(varargin{1}.Peer, 'Tag'), '_', varargin{end}];
                  vin{3} = varargin{1};
                  vin{4} = varargin{end-1};
                  vin{5} = guidata(varargin{1}.Peer);
                  feval(vin{:});
                  return;
          elseif local_isInvokeHGCallback(gui_State, varargin{:})
                  % GUITUTORIAL_EXPORT('CALLBACK',hObject,eventData,handles,...)
                  gui_Create = false;
          else
                  % GUITUTORIAL_EXPORT(...)
                  % create the GUI and hand varargin to the openingfcn
                  gui_Create = true;
          end
      
          if ~gui_Create
                  % In design time, we need to mark all components possibly created in
                  % the coming callback evaluation as non-serializable. This way, they
                  % will not be brought into GUIDE and not be saved in the figure file
                  % when running/saving the GUI from GUIDE.
                  designEval = false;
                  if (numargin>1 && ishghandle(varargin{2}))
                          fig = varargin{2};
                          while ~isempty(fig) && ~isa(handle(fig),'figure')
                                  fig = get(fig,'parent');
                          end
      
                          designEval = isappdata(0,'CreatingGUIDEFigure') || isprop(fig,'__GUIDEFigure');
                  end
      
                  if designEval
                          beforeChildren = findall(fig);
                  end
      
                  % evaluate the callback now
                  varargin{1} = gui_State.gui_Callback;
                  if nargout
                          [varargout{1:nargout}] = feval(varargin{:});
                  else       
                          feval(varargin{:});
                  end
      
                  % Set serializable of objects created in the above callback to off in
                  % design time. Need to check whether figure handle is still valid in
                  % case the figure is deleted during the callback dispatching.
                  if designEval && ishandle(fig)
                          set(setdiff(findall(fig),beforeChildren), 'Serializable','off');
                  end
          else
                  if gui_State.gui_Singleton
                          gui_SingletonOpt = 'reuse';
                  else
                          gui_SingletonOpt = 'new';
                  end
      
                  % Check user passing 'visible' P/V pair first so that its value can be
                  % used by oepnfig to prevent flickering
                  gui_Visible = 'auto';
                  gui_VisibleInput = '';
                  for index=1:2:length(varargin)
                          if length(varargin) == index || ~ischar(varargin{index})
                                  break;
                          end
      
                          % Recognize 'visible' P/V pair
                          len1 = min(length('visible'),length(varargin{index}));
                          len2 = min(length('off'),length(varargin{index+1}));
                          if ischar(varargin{index+1}) && strncmpi(varargin{index},'visible',len1) && len2 > 1
                                  if strncmpi(varargin{index+1},'off',len2)
                                          gui_Visible = 'invisible';
                                          gui_VisibleInput = 'off';
                                  elseif strncmpi(varargin{index+1},'on',len2)
                                          gui_Visible = 'visible';
                                          gui_VisibleInput = 'on';
                                  end
                          end
                  end
      
                  % Open fig file with stored settings.  Note: This executes all component
                  % specific CreateFunctions with an empty HANDLES structure.
      
      
                  % Do feval on layout code in m-file if it exists
                  gui_Exported = ~isempty(gui_State.gui_LayoutFcn);
                  % this application data is used to indicate the running mode of a GUIDE
                  % GUI to distinguish it from the design mode of the GUI in GUIDE. it is
                  % only used by actxproxy at this time.   
                  setappdata(0,genvarname(['OpenGuiWhenRunning_', gui_State.gui_Name]),1);
                  if gui_Exported
                          gui_hFigure = feval(gui_State.gui_LayoutFcn, gui_SingletonOpt);
      
                          % make figure invisible here so that the visibility of figure is
                          % consistent in OpeningFcn in the exported GUI case
                          if isempty(gui_VisibleInput)
                                  gui_VisibleInput = get(gui_hFigure,'Visible');
                          end
                          set(gui_hFigure,'Visible','off')
      
                          % openfig (called by local_openfig below) does this for guis without
                          % the LayoutFcn. Be sure to do it here so guis show up on screen.
                          movegui(gui_hFigure,'onscreen');
                  else
                          gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
                          % If the figure has InGUIInitialization it was not completely created
                          % on the last pass.  Delete this handle and try again.
                          if isappdata(gui_hFigure, 'InGUIInitialization')
                                  delete(gui_hFigure);
                                  gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
                          end
                  end
                  if isappdata(0, genvarname(['OpenGuiWhenRunning_', gui_State.gui_Name]))
                          rmappdata(0,genvarname(['OpenGuiWhenRunning_', gui_State.gui_Name]));
                  end
      
                  % Set flag to indicate starting GUI initialization
                  setappdata(gui_hFigure,'InGUIInitialization',1);
      
                  % Fetch GUIDE Application options
                  gui_Options = getappdata(gui_hFigure,'GUIDEOptions');
                  % Singleton setting in the GUI M-file takes priority if different
                  gui_Options.singleton = gui_State.gui_Singleton;
      
                  if ~isappdata(gui_hFigure,'GUIOnScreen')
                          % Adjust background color
                          if gui_Options.syscolorfig
                                  set(gui_hFigure,'Color', get(0,'DefaultUicontrolBackgroundColor'));
                          end
      
                          % Generate HANDLES structure and store with GUIDATA. If there is
                          % user set GUI data already, keep that also.
                          data = guidata(gui_hFigure);
                          handles = guihandles(gui_hFigure);
                          if ~isempty(handles)
                                  if isempty(data)
                                          data = handles;
                                  else
                                          names = fieldnames(handles);
                                          for k=1:length(names)
                                                  data.(char(names(k)))=handles.(char(names(k)));
                                          end
                                  end
                          end
                          guidata(gui_hFigure, data);
                  end
      
                  % Apply input P/V pairs other than 'visible'
                  for index=1:2:length(varargin)
                          if length(varargin) == index || ~ischar(varargin{index})
                                  break;
                          end
      
                          len1 = min(length('visible'),length(varargin{index}));
                          if ~strncmpi(varargin{index},'visible',len1)
                                  try set(gui_hFigure, varargin{index}, varargin{index+1}), catch break, end
                          end
                  end
      
                  % If handle visibility is set to 'callback', turn it on until finished
                  % with OpeningFcn
                  gui_HandleVisibility = get(gui_hFigure,'HandleVisibility');
                  if strcmp(gui_HandleVisibility, 'callback')
                          set(gui_hFigure,'HandleVisibility', 'on');
                  end
      
                  feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
      
                  if isscalar(gui_hFigure) && ishandle(gui_hFigure)
                          % Handle the default callbacks of predefined toolbar tools in this
                          % GUI, if any
                          guidemfile('restoreToolbarToolPredefinedCallback',gui_hFigure); 
      
                          % Update handle visibility
                          set(gui_hFigure,'HandleVisibility', gui_HandleVisibility);
      
                          % Call openfig again to pick up the saved visibility or apply the
                          % one passed in from the P/V pairs
                          if ~gui_Exported
                                  gui_hFigure = local_openfig(gui_State.gui_Name, 'reuse',gui_Visible);
                          elseif ~isempty(gui_VisibleInput)
                                  set(gui_hFigure,'Visible',gui_VisibleInput);
                          end
                          if strcmpi(get(gui_hFigure, 'Visible'), 'on')
                                  figure(gui_hFigure);
      
                                  if gui_Options.singleton
                                          setappdata(gui_hFigure,'GUIOnScreen', 1);
                                  end
                          end
      
                          % Done with GUI initialization
                          if isappdata(gui_hFigure,'InGUIInitialization')
                                  rmappdata(gui_hFigure,'InGUIInitialization');
                          end
      
                          % If handle visibility is set to 'callback', turn it on until
                          % finished with OutputFcn
                          gui_HandleVisibility = get(gui_hFigure,'HandleVisibility');
                          if strcmp(gui_HandleVisibility, 'callback')
                                  set(gui_hFigure,'HandleVisibility', 'on');
                          end
                          gui_Handles = guidata(gui_hFigure);
                  else
                          gui_Handles = [];
                  end
      
                  if nargout
                          [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
                  else
                          feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
                  end
      
                  if isscalar(gui_hFigure) && ishandle(gui_hFigure)
                          set(gui_hFigure,'HandleVisibility', gui_HandleVisibility);
                  end
          end
      
          function gui_hFigure = local_openfig(name, singleton, visible)
      
          % openfig with three arguments was new from R13. Try to call that first, if
          % failed, try the old openfig.
          if nargin('openfig') == 2
                  % OPENFIG did not accept 3rd input argument until R13,
                  % toggle default figure visible to prevent the figure
                  % from showing up too soon.
                  gui_OldDefaultVisible = get(0,'defaultFigureVisible');
                  set(0,'defaultFigureVisible','off');
                  gui_hFigure = openfig(name, singleton);
                  set(0,'defaultFigureVisible',gui_OldDefaultVisible);
          else
                  gui_hFigure = openfig(name, singleton, visible);
          end
      
          function result = local_isInvokeActiveXCallback(gui_State, varargin)
      
          try
                  result = ispc && iscom(varargin{1}) ...
                                   && isequal(varargin{1},gcbo);
          catch
                  result = false;
          end
      
          function result = local_isInvokeHGCallback(gui_State, varargin)
      
          try
                  fhandle = functions(gui_State.gui_Callback);
                  result = ~isempty(findstr(gui_State.gui_Name,fhandle.file)) || ...
                                   (ischar(varargin{1}) ...
                                   && isequal(ishandle(varargin{2}), 1) ...
                                   && (~isempty(strfind(varargin{1},[get(varargin{2}, 'Tag'), '_'])) || ...
                                          ~isempty(strfind(varargin{1}, '_CreateFcn'))) );
          catch
                  result = false;
          end
      

      【讨论】:

        【解决方案3】:

        您应该使用 GUIDE 功能来帮助您入门。

        http://www.mathworks.com/help/techdoc/ref/guide.html

        您列出的所有功能都可以通过此工具使用。为了将您的 GUI 功能“连接”在一起,最关键的项目之一是学习如何在函数之间传递数据。默认情况下,GUIDE 有一个函数回调,其中包含一个名为“handles”的 Matlab 结构(您可以将其更改为您想要的任何内容。尝试在函数之间简单地传递一些值即可开始使用。

        【讨论】:

          猜你喜欢
          • 2016-10-01
          • 2014-02-03
          • 1970-01-01
          • 1970-01-01
          • 2016-12-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-04-23
          相关资源
          最近更新 更多