我试过在MATLAB中使用2-按钮,但是一旦按下按钮,当我尝试使用另一个按钮时,就会产生错误

时间:2014-01-18 10:06:08

标签: matlab user-interface

所以,我试图在两个按钮之间等待,但仍然显示错误。我试图在按钮功能结束时使用“返回”,认为它宁愿留在GUI中进行进一步的命令,但似乎不行。

显示的错误是:

Undefined function 'uiControls' for input
arguments of type 'struct'.

Error in
@(hObject,eventdata)uiControls('unitgroup_SelectionChangeFcn',get(hObject,'SelectedObject'),eventdata,guidata(get(hObject,'SelectedObject')))


Error in hgfeval (line 63)
    feval(fcn{1},varargin{:},fcn{2:end});

Error in
uitools.uibuttongroup/childAddedCbk>manageButtons
(line 79)
hgfeval(cbk, source, evdata);

Error while evaluating uicontrol Callback

我编写的代码供参考:

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

    % Last Modified by GUIDE v2.5 18-Jan-2014 00:48:05

    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @uiControls_OpeningFcn, ...
                       'gui_OutputFcn',  @uiControls_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 uiControls is made visible.
    function uiControls_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 uiControls (see VARARGIN)
    % Choose default command line output for uiControls
    % This section is used for displaying the logo of the SMERC
    handles.output = hObject;
    imshow('D:\SMERC\Abstract Model\Phani\Essentials\S1_new.jpg');
    g = warndlg('SMERC Randomizer User Guide> Select the desired number of ESM >> Press the Randomize Push button', 'Alert');
    waitfor(g);
    % Update handles structure
    guidata(hObject, handles);
    initialize_gui(hObject, handles, false);

    % --- Executes during object creation, after setting all properties.
    function density_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to density (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end

    %Randomizer Code~ Integrted into the Time Reference 
    % --- Executes when selected object is changed in uipanel13.
    function uipanel13_SelectionChangeFcn(hObject, eventdata, handles)
    % hObject    handle to the selected object in uipanel13 
    % 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)
    global tmp;
    if hObject == handles.one
    tmp=1;
    elseif hObject == handles.two
    tmp=2;
    elseif hObject == handles.three
    tmp=3;
    elseif hObject == handles.four
    tmp=4;
    end

    %Density=Valued Dec
    function density_Callback(hObject, eventdata, handles)
    % hObject    handle to density (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of density as text
    %        str2double(get(hObject,'String')) returns contents of density as a double
    density = str2double(get(hObject, 'String'));
    if isnan(density)
        set(hObject, 'String', 0);
        errordlg('Input must be a number','Error');
    end
    % Save the new density value
    handles.metricdata.density = density;
    guidata(hObject,handles)

    % --- Executes during object creation, after setting all properties.
    function volume_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to volume (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called

    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end


    % %->Volume
    % The value in the density block is set to 0 and get the value in the
    % string  So basically this is how we get the value in the GUI
    function volume_Callback(hObject, eventdata, handles)
    % hObject    handle to volume (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % Hints: get(hObject,'String') returns contents of volume as text
    %        str2double(get(hObject,'String')) returns contents of volume as a double
    volume = str2double(get(hObject, 'String'));
    if isnan(volume)
        set(hObject, 'String', 0);
        errordlg('Input must be a number','Error');
    end
    % Save the new volume value
    handles.metricdata.volume = volume;
    guidata(hObject,handles)



    % --- Executes on button press in reset.
    function reset_Callback(hObject, eventdata, handles)
    % hObject    handle to reset (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    initialize_gui(gcbf, handles, true);

    % --- Executes when selected object changed in unitgroup.
    function unitgroup_SelectionChangeFcn(hObject, eventdata, handles)
    % hObject    handle to the selected object in unitgroup 
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    set(handles.text4, 'String', 'Amps');
    set(handles.text5, 'String', '%');
    set(handles.text6, 'String', 'Amps');
    global x;
    if hObject == handles.english
    x=1
    elseif hObject == handles.afterNoon
    x=2
    elseif hObject == handles.night
    x=3
    end

    % --- Executes on button press in pushbutton9.
    function pushbutton9_Callback(hObject, eventdata, handles)
    % hObject    handle to pushbutton9 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    format long;
    global tmp;
    %disp(tmp);
    disp('SMERC-Phani Madhav Yannam');
    cd('D:\SMERC\Abstract Model\new\Model+XML\xmlout');
    %warning('Enter a value greater than Zero');

    for i=1:tmp;
                    [files{i}] = uigetfile('.xml');
                   % delete XY after you validate the Time Stamp and the ESM
                   % IDs
                   %xy{i}=files{i};
    end
    new_counttv(tmp)=0;
    new_countFan(tmp)=0;
    new_countFL(tmp)=0;
    new_countIL(tmp)=0;
    new_countDW(tmp)=0;
    new_countWS(tmp)=0;
    new_countAC(tmp)=0;
    new_countVC(tmp)=0;
    new_countMW(tmp)=0;
    global result1;
    global amp;
    result1=[];
         amp=0;
         %sum_load=0;
         for i = 1:tmp;
                    docNode = xmlread(files{i});
                    root = docNode.getDocumentElement;
                    tag = root.getElementsByTagName('total_amperage');
                    loads1 = [];
                    for k = 0:tag.getLength-1
                        node = tag.item(k);
                    loads1 = cat(2,loads1,[node.getTextContent]);
                    end
                    fprintf('The total amperage of the Apartment %d:%d \n',i);
                    disp(loads1);
                    amp=amp+str2double(loads1);
                    result1 = cat(2,result1,loads1);
                    %loads(i) = str2double(char(tag.getTextContent));
         end

                  fprintf('The Total Amperage of %d Apartments: %d \n',tmp,int16(amp));
                  global newloads;
                  global loads;
                  global y;
                  result=[];
                  new_result=[];
                  for i = 1:tmp;
                    fprintf('Report for the Apartment %d: \n',i);
                    fprintf('The devices list in the Apartment %d: \n',i);
                    docNode = xmlread(files{i});
                    root = docNode.getDocumentElement;
                    tag = root.getElementsByTagName('device');
                    loads = [];
                    newloads=[];
                    for k = 0:tag.getLength-1
                        node = tag.item(k);
                        disp([node.getTextContent]);
                        loads = cat(2,loads,[node.getTextContent]);
                        ll=length(loads);
                    end 
    %     for  j=1:ll             
    %     if  loads(j)=='TV';
    %         new_counttv(i)= new_counttv(i)+1
    %     elseif loads(j)=='Fan';
    %         new_countFan(i)= new_countFan(i)+1
    %     elseif loads(j)== 'Fluorescent Light';
    %         new_countFL(i)= new_countFL(i)+1
    %     elseif loads(j)== 'Incandescent Light';
    %         new_countIL(i)= new_countIL(i)+1
    %     elseif loads(j)== 'AC';
    %         new_countAC(i)= new_countAC(i)+1
    %     elseif loads(j)== 'Dishwasher';
    %         new_countDW(i)= new_countDW(i)+1
    %     elseif loads(j)== 'Washer';
    %         new_countWS(i)= new_countWS(i)+1
    %     elseif loads(j)== 'Vaccumm';
    %         new_countVC(i)= new_countVC(i)+1
    %     elseif loads(j)=='Microwave';
    %         new_countMW(i)=new_count(i)+1;
    %     end
    %     end
                    for j=1:ll
                    if strcmp(loads(j),'TV');
                       new_counttv(1,i)= new_counttv(i)+1;
                    elseif strcmp(loads(j),'Fan');
                       new_countFan(1,i)= new_countFan(i)+1;
                       disp(new_countFan(1,i));
                    elseif strcmp(loads(j),'Fluorescent Light');
                        new_countFL(1,i)= new_countFL(i)+1;
                    elseif strcmp(loads(j),'Incandescent Light');
                        new_countIL(1,i)= new_countIL(i)+1;
                    elseif strcmp(loads(j),'AC');
                        new_countAC(1,i)= new_countAC(i)+1;
                    elseif strcmp(loads(j),'Dishwasher');
                        new_countDW(1,i)= new_countDW(i)+1;
                    elseif strcmp(loads(j),'Washer');
                        new_countWS(1,i)= new_countWS(i)+1;
                    elseif strcmp(loads(j),'Vaccuum Cleaner');
                        new_countVC(1,i)= new_countVC(i)+1;
                    elseif strcmp(loads(j),'Microwave');
                        new_countMW(1,i)=new_count(i)+1;
                    end
                    end

                    result= cat(2,result,loads);
                    new_result=cat(2,new_result,loads);
                    y=length(result);
                    size(i+1)= length(result);
                   end

    %               -----------------------------------------------
    %                new_loads=[];
    %                for i = 1:tmp;
    %                 docNode = xmlread(files{i});
    %                 root = docNode.getDocumentElement;
    %                 tag = root.getElementsByTagName('device');
    %                 for k = 0:tag.getLength-1
    %                     node = tag.item(k);
    %                     %disp([node.getTextContent]);
    %                     
    %                     str=str2num([node.getTextContent])                
    %                     %combinedStr = strcat(str, str)
    %                     %str= strcat(str,' morning')
    %                     new_loads = cat(2,loads,[node.getTextContent]);                
    %                 end
    %                end
    % %               
    %               -----------------------------------------------

    %Functions for Searches through the documents- 
    % for i=1:tmp
    % for k=1:y
    %     if  new_result(k)== 'TV';
    %         new_counttv(i)= new_counttv(i)+1
    %     elseif new_result(k)== 'Fan';
    %         new_countFan(i)= new_countFan(i)+1
    %     elseif new_result(k)== 'Fluorescent Light';
    %         new_countFL(i)= new_countFL(i)+1
    %     elseif new_result(k)== 'Incandescent Light';
    %         new_countIL(i)= new_countIL(i)+1
    %     elseif new_result(k)== 'AC';
    %         new_countAC(i)= new_countAC(i)+1
    %     elseif new_result(k)== 'Dishwasher';
    %         new_countDW(i)= new_countDW(i)+1
    %     elseif new_result(k)== 'Washer';
    %         new_countWS(i)= new_countWS(i)+1
    %     elseif new_result(k)== 'Vaccumm';
    %         new_countVC(i)= new_countVC(i)+1
    %     elseif new_result(k)=='Microwave';
    %         new_countMW(i)=new_count(i)+1;
    %     end
    % end    
    % end
    % 
    %               for i=tmp:-1:1
    %                   if i>1
    %                     new_counttv(i)=new_counttv(i)-new_counttv(i-1);
    %                     fprintf('The total number of TV in the Aparment %d are: %d \n',i,new_counttv(i));
    %                     fprintf('The total number of devices in the Apartment %d are: %d \n',i,n(i));
    %                   else
    %                     fprintf('The total number of TV in the Aparment %d are: %d \n',i,new_counttv(i));
    %                   end
    %               end


                  for i=tmp:-1:1
                        n(i)=size(i+1)-size(i);
                        fprintf('The total number of devices in the Apartment %d are: %d \n',i,n(i));

                        %loads(i) = str2double(char(tag.getTextContent));
                  end
                 %_-----------------------------------------------
    for i=1:tmp
                 fprintf('Apt %d TV: %d \n ',i,(new_counttv(i)));
                 fprintf('Apt %d Fan: %d \n ',i,(new_countFan(i)));
                 fprintf('Apt %d FL: %d \n ',i,(new_countFL(i)));
                 fprintf('Apt %d IL: %d \n ',i,(new_countIL(i)));
                 fprintf('Apt %d AC: %d \n ',i,(new_countAC(i)));
                 fprintf('Apt %d VC: %d \n ',i,(new_countVC(i)));
                 fprintf('Apt %d DW: %d \n ',i,(new_countDW(i)));
                 fprintf('Apt %d WS: %d \n ',i,(new_countWS(i)));
                 fprintf('Apt %d MW: %d \n ',i,(new_countMW(i)));
    end
                  n_boundrand_tv(tmp)=0;
                  n_boundrand_fn(tmp)=0;
                  n_boundrand_IL(tmp)=0;
                  n_boundrand_AC(tmp)=0;
                  n_boundrand_DW(tmp)=0;
                  n_boundrand_WS(tmp)=0;
                  n_boundrand_FL(tmp)=0;
                  n_boundrand_VC(tmp)=0;
                  n_boundrand_MW(tmp)=0;
                  n_rand_total(tmp)=0;

                  for i=1:tmp
            if new_counttv(i)<1;
            n_boundrand_tv(i)=0;
            else
            n_boundrand_tv(i) =n_boundrand_tv(i)+randi([0,new_counttv(i)]);
            n_rand_total(i)= n_boundrand_tv(i)+n_rand_total(i);
            end

            if new_countFan(i)<1;
            n_boundrand_fn(i)=0;
            else
            n_boundrand_fn(i)=n_boundrand_fn(i)+randi([0,new_countFan(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_fn(i);
            end

            if new_countIL(i)<1;
            n_boundrand_IL(i)=0;
            else
            n_boundrand_IL(i)=n_boundrand_IL(i)+randi([0,new_countIL(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_IL(i);
            end

            if new_countFL(i)<1;
            n_boundrand_FL(i)=0;
            else
            n_boundrand_FL(i)=n_boundrand_FL(i)+randi([0,new_countFL(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_FL(i);
            end

            if new_countAC(i)<1;
            n_boundrand_AC(i)=0;
            else
            n_boundrand_AC(i)=n_boundrand_AC(i)+randi([0,new_countAC(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_AC(i);
            end

            if new_countDW(i)<1;
            n_boundrand_DW(i)=0;
            else
            n_boundrand_DW(i)=n_boundrand_DW(i)+randi([0,new_countDW(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_DW(i);
            end

            if new_countWS(i)<1;
            n_boundrand_WS(i)=0;
            else
            n_boundrand_WS(i)=n_boundrand_WS(i)+randi([0,new_countWS(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_WS(i);
            end

            if new_countVC(i)<1;
            n_boundrand_VC(i)=0;
            else
            n_boundrand_VC(i)=n_boundrand_VC(i)+randi([0,new_countVC(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_VC(i);
            end

            if new_countMW(i)<1;
            n_boundrand_MW(i)=0;
            else
            n_boundrand_MW(i)=n_boundrand_MW(i)+randi([0,new_countMW(i)]);
            n_rand_total(i)=n_rand_total(i)+n_boundrand_MW(i);
            end
                  end

            global n_a;
            n_a=sum(n_rand_total);
            fprintf('After Randomising the %d Apartments, The list of %d random devices are:\n \n',tmp,n_a);


    %-----------------------------------------------------------------------------
                % Delete the below values // n-disp the below
                global rcounttv;
                global rcountFan;
                global rcountFL;
                global rcountIL;
                global rcountAC;
                global rcountDW;
                global rcountWS;
                global rcountVC;
                global rcountMW;

                global counttv;
                global countFan;
                global countFL;
                global countIL;
                global countDW;
                global countWS;
                global countAC;
                global countVC;
                global countMW;

                counttv=0;
                countFan=0;
                countFL=0;
                countIL=0 ;
                countDW=0;
                countWS=0;
                countAC=0;
                countVC=0;
                countMW=0;



   disp('Report:');
              fprintf('Total Number of TV in the %d Apartments are: %d \n',tmp,sum(new_counttv));
              fprintf('Total Number of Fan in the %d Apartments are: %d \n',tmp,sum(new_countFan));
              fprintf('Total Number of Flourescent lights in the %d Apartments are: %d \n',tmp,sum(new_countFL));
              fprintf('Total Number of Incadescent Light in the %d Apartments are: %d \n',tmp,sum(new_countIL));
              fprintf('Total Number of Dishwashers in the %d Apartments are: %d \n',tmp,sum(new_countDW));
              fprintf('Total Number of AC in the %d Apartments are: %d \n',tmp,sum(new_countAC));
              fprintf('Total Number of Vacuum Cleaners in the %d Apartments are: %d \n',tmp,sum(new_countVC));
              fprintf('Total Number of Microwave in the %d Apartments are: %d \n',tmp,sum(new_countMW));
              fprintf('Total Number of Washers in the %d Apartments are : %d \n \n',tmp, sum(new_countWS));


            fprintf('After Randomising the %d Apartments, The list of %d random devices are:\n \n',tmp,sum(n_a));
           % Print the list of the random devices.

           for j=1:tmp
               if n_boundrand_AC(j)>0
                   for i=1:n_boundrand_AC(j)
                       disp('AC');
                   end
               end

               if n_boundrand_tv(j)>0
               for i=1:n_boundrand_tv(j)
                   disp('TV');
               end
               end

               if n_boundrand_fn(j)>0
               for i=1:n_boundrand_fn(j)
                   disp('Fan');
               end
               end

               if n_boundrand_FL(j)>0
               for i=1:n_boundrand_FL(j)
                   disp('Flourescent Light');
               end
               end

               if n_boundrand_IL(j)>0
               for i=1:n_boundrand_IL(j)
                   disp('Incadescent Light');
               end
               end

               if n_boundrand_DW(j)>0
               for i=1:n_boundrand_DW(j)
                   disp('Dishwashers');
               end
               end

               if n_boundrand_VC(j)>0
               for i=1:n_boundrand_VC(j)
                   disp('Vacumm Cleaner');
               end
               end

               if n_boundrand_MW(j)>0
               for i=1:n_boundrand_MW(j)
                   disp('Microwave');
               end
               end

               if n_boundrand_WS(j)>0
               for i=1:n_boundrand_WS(j)
                   disp('Washers');
               end
               end
           end
            fprintf('\n');

          AC=18;
          MW=10;
          WS=5;
          DW=18;
          FL=0.2;
          IL=0.5;
          tv=1.5;
          fan=1.5;
          VC= 7.3;

          global rts;     
          rts=(sum(n_boundrand_tv*tv))+(sum(n_boundrand_fn)*fan)+(sum(n_boundrand_FL)*FL)+(sum(n_boundrand_IL)*IL)+(sum(n_boundrand_DW)*DW)+(sum(n_boundrand_WS)*WS)+(sum(n_boundrand_AC*AC))+(sum(n_boundrand_VC)*VC)+(sum(n_boundrand_MW)*MW);

          fprintf('Random Engine Report: \n');                              
          fprintf('Total Number of TV in the %d Apartments are: %d \n',tmp,sum(n_boundrand_tv));
          fprintf('Total Number of Fan in the %d Apartments are: %d \n',tmp,sum(n_boundrand_fn));
          fprintf('Total Number of Flourescent lights in the %d Apartments are: %d \n',tmp,sum(n_boundrand_FL));
          fprintf('Total Number of Incadescent Light in the %d Apartments are: %d \n',tmp,sum(n_boundrand_IL));
          fprintf('Total Number of Dishwashers in the %d Apartments are: %d \n',tmp,sum(n_boundrand_DW));
          fprintf('Total Number of AC in the %d Apartments are: %d \n',tmp,sum(n_boundrand_AC));
          fprintf('Total Number of Vacuum Cleaners in the %d Apartments are: %d \n',tmp,sum(n_boundrand_VC));
          fprintf('Total Number of Microwave in the %d Apartments are: %d \n',tmp,sum(n_boundrand_MW));
          fprintf('Total Number of Washers in the %d Apartments are: %d \n', tmp, sum(n_boundrand_WS));

    %  should be random sum // is it ?
    % Demand Response
    %rts=int16(((rcounttv*tv)+(rcountFan*fan)+(rcountFL*FL)+(rcountIL*IL)+(rcountDW*DW)+(rcountWS*DW)+(rcountAC*AC)+(rcountMW*MW)+(rcountVC*VC)));
    fprintf('The total amperage of the generated devices by the engine is %d \n', int16(rts));
    return;



    % --------------------------------------------------------------------


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

    mass = handles.metricdata.density * handles.metricdata.volume;
    set(handles.mass, 'String', mass);

    function initialize_gui(fig_handle, handles, isreset)
    % If the metricdata field is present and the reset flag is false, it means
    % we are we are just re-initializing a GUI by calling it from the cmd line
    % while it is up. So, bail out as we dont want to reset the data.
    if isfield(handles, 'metricdata') && ~isreset
        return;
    end

    handles.metricdata.density = 0;
    handles.metricdata.volume  = 0;

    set(handles.density, 'String', handles.metricdata.density);
    set(handles.volume,  'String', handles.metricdata.volume);
    set(handles.mass, 'String', 0);

    set(handles.unitgroup, 'SelectedObject', handles.english);

    set(handles.text4, 'String', 'Amps');
    set(handles.text5, 'String', '%');
    set(handles.text6, 'String', 'Amps');

    % Update handles structure
    guidata(handles.figure1, handles);

1 个答案:

答案 0 :(得分:1)

上述问题的答案在于更改目录。它实际上改变了命令行的整个目录 - 它不允许GUI重新初始化自己。而是使用精确的语法可能会对我们有所帮助。

我尝试使用以下代码来解决此问题。

[files{i}] = uigetfile('*.xml','Hello','D:\SMERC\Abstract Model\new\Model+XML\xmlout')