如果使用不同版本的Matlab,则Matlab GUI会出现故障

时间:2018-02-16 13:29:51

标签: matlab user-interface

我使用Matlab 2013a创建了一个GUI。图形用户界面是使用功能创建的:未使用GUIDE。

如果使用Matlab版本2013a,GUI将按预期工作。无论如何,它在Matlab Release R2016a上出现故障:整个GUI看起来像被压缩并被推向屏幕的底部。

我附上了一张照片,这样你就可以更清楚地看到我的意思了。

GUI malfunctioning on a different version of Matlab

请参阅下面的部分代码:

function NoAp_x 

fig_col=[0.99 0.99 0.99];
pan_col=[1 1 1];
entryField_color=[0.99 0.99 0.99];
entryField_color_II=[0.99 0.99 0.99];
entryField_color_III=[0.99 0.99 0.99];  

hFig= figure('MenuBar','none',...
  'Units','Pixels',...
  'Color',fig_col,...
  'Toolbar','none',...
  'Name','NoAp, modelo',...
  'resize','off',...
  'NumberTitle','off',...
  'Position',[1 500 1280 903]);  

movegui(hFig,'center');

warning off MATLAB:uitabgroup:OldVersion  % turn off warning  

hg=uitabgroup('Parent',hFig,...%%%List
  'units','pixels','position',...
  [1.5 65 1277 950]);  

  %%%%% Menu 'File' %%%%%%  
    m = uimenu('Label','&File');uimenu(m,'Label','New','Callback','FigureA'); uimenu(m,'Label','New  Figure','Callback','figure');uimenu(m,'Label','Quit','Callback','close',...
    'Separator','on','Accelerator','Q'); 

    %%%%% Menu 'Edit' %%%%%%
      m = uimenu('Label','&Edit');uimenu(m,'Label','&Undo');uimenu(m,'Label','&Redo');
        uimenu(m,'Label','&Find','Separator','on');uimenu(m,'Label','&Replace');

      %%%%% Menu 'Help' %%%%%%
         m = uimenu('Label','&Help');
         uimenu(m,'Label','Help','Callback', @NotImplemented);

%%%%% Menu 'About' %%%%%%
    uimenu(m,'Label','About','Separator','on','Callback', @About);

%------------------------------------------------------Tabs----------------------------------------------------------------%
ht(1)=uitab(hg,'Title','Reliability analysis');
%-----------------------------------------------------Panels----------------------------------------------------------------

cnames = {'Item','model','F.Rate','MTTF','Reliabilty (t)'};

hPanA = uipanel(...
'Title','',...
'Fontsize',22,...
'Parent', ht(1),...
'Units','Pixels',...
'BorderWidth',1,...
'Position',[1 1 1263 1050.2],...
'BackgroundColor',pan_col);
%---------------------------------------------------Sub_Panels--------------------------------------------------------------

%## 217 Plus Sub Panels ##%

hRelPan1 = uipanel('Parent',...
    hPanA,'Units','pixels',...
    'Title','Previous Selection',...
    'Fontsize',17,...
    'BackgroundColor',[1 1 1],...
    'Position',[4.5 100 590 132],'BorderWidth',2);

hRelSPan1 = uipanel('Parent',hRelPan1,...
    'Units','pixels','Title','Pick your device ',...
    'Fontsize',14,'BackgroundColor',[1 1 1],...
    'Position',[1 165 330.5 115],'BorderWidth',1);

hRelSPan2 = uipanel('Parent',hRelPan1,...
    'Units','pixels','Title','Base failure rate','Fontsize',...
    12,'BackgroundColor',[1 1 1],'Position',...
    [1 59.5 331.5 57],'BorderWidth',1);

hRelSPanA = uipanel('Parent',hRelPan1,...
    'Units','pixels','Title','Parameters according to 217 Plus','Fontsize',...
    14,'BackgroundColor',[1 1 1],'Position',...
    [340 53.5 238.5 157],'BorderWidth',1);

hcapacPanA = uipanel('Parent',hRelSPanA,...
    'Units','pixels','Title','Capacitors only','Fontsize',...
    14,'BackgroundColor',[1 1 1],'Position',...
    [1 1 232.5 53],'BorderWidth',1);

hRelSPan3 = uipanel('Parent',hRelPan1,...
    'Units','pixels','Title','Default environmental stress & operating profiles','Fontsize',...
    12,'BackgroundColor',[1 1 1],'Position',...
    [1 116.5 331.5 48],'BorderWidth',1);


hRelSPan4 = uipanel('Parent',hRelPan1,...
    'Units','pixels','Title','Failure rate multipliers',...
    'Fontsize',14,'BackgroundColor',[1 1 1],...
    'Position',[1 3 573.5 53],'BorderWidth',1);

hRelPan2 = uipanel('Parent',hPanA,'Units',...
    'pixels','Title','Statistics','Fontsize',14,...
    'BackgroundColor',[1 1 1],'Position',[600 6.5 655 219],...
    'BorderWidth',2);

hRelSPan5 = uipanel('Parent',hRelPan2,'Units',...
    'pixels','Title','Adjustment','Fontsize',14,...
       'BackgroundColor',[1 1 1 ],'Position',[130 85 410 37],...
       'BorderWidth',1);

hRelPan4 = uipanel('Parent',hPanA,'Units',...
    'pixels','Title','Results','Fontsize',14,...
       'BackgroundColor',[1 1 1],'Position',[600 225.5 655 106],...
       'BorderWidth',2);

hMissionP = uipanel('Parent',hPanA,'Units',...
    'pixels','Title','Mission Parameters','Fontsize',14,...
       'BackgroundColor',[1 1 1],'Position',[5 43.5 165 56],...
       'BorderWidth',2);

hRelSPan6 = uipanel('Parent',hPanA,'Units',...
    'pixels','Title','Preliminary results','Fontsize',12,...
       'BackgroundColor',[1 1 1 ],'Position',[173 3 170 96],...
       'BorderWidth',2);

hPlotPan = uipanel('Parent',hPanA,'Units',...
    'pixels','Title','Reliability vs time','Fontsize',12,...
       'BackgroundColor',[1 1 1 ],'Position',[354 3 240 96],...
       'BorderWidth',2);   


hRelSPan7 = uipanel('Parent',hRelPan4,'Units',...
    'pixels','Title','Summary','Fontsize',11,...
       'BackgroundColor',[1 1 1 ],'Position',[10 18 630 70],...
       'BorderWidth',1);

%-------------------------------------------------- Plots ------
%##### Relis Analysis Plots--------

hRelisG1 = axes('Parent',hPlotPan,'Units',...
    'pixels','Position',[40 18 150 45],'Color',[1 1 1]);

hRelisG2 = axes('Parent',hRelPan2,'Units',...
    'pixels','Position',[45 140 195 50],'Color',[1 1 1]); %%%1

hRelisG3 = axes('Parent',hRelPan2,'Units',...
    'pixels','Position',[420 140 195 50],'Color',[1 1 1]); %%%2

hRelisG4 = axes('Parent',hRelPan2,'Units',...
    'pixels','Position',[45 20 195 50],'Color',[1 1 1]); %%%3

hRelisG5 = axes('Parent',hRelPan2,'Units',...
    'pixels','Position',[420 19 195 50],'Color',[1 1 1]); %%%4
%-------------------------------------------------Radio Buttons -----------------------------------------------------------------
%# Relis Radio Buttons

hReLs = uibuttongroup('Position',[.05,.05,.9,.9],...
    'Parent',hRelSPan5,'Units','Normalized');

uicontrol('Style','RadioButton','String',...
    'Exponential','FontSize',11,'Position',[0.03,0.67,0.46,0.29],...
    'Parent',hReLs,'Tag','exp','Units','normalized');

uicontrol('Style','RadioButton','String','PDF',...
    'FontSize',11,'Position',[0.26,0.67,0.46,0.29],...
    'Parent',hReLs,'Tag','pdf','Units','normalized');

uicontrol('Style','RadioButton','String','CDF',...
    'FontSize',11,'Position',[0.03,0.15,0.46,0.29],...
    'Parent',hReLs,'Tag','cdf','Units','normalized');

uicontrol('Style','RadioButton','String','1-CDF',...
    'FontSize',11,'Position',[0.26,0.15,0.46,0.29],...
    'Parent',hReLs,'Tag','1-cdf','Units','normalized');

handle_list=...
[hFig,hg,ht(1),hPanA,hRelPan1,hRelSPan1,hRelSPan2,hRelSPanA,hcapacPanA,...
hRelSPan3,hRelSPan4,hRelSPan5,hRelSPan6,hPlotPan,hRelSPan7,hRelPan2,hRelPan4,...
hMissionP,hRelisG1,hRelisG2,hRelisG3,hRelisG4,hRelisG5,hReLs];
set(handle_list,'Units','normalized');
end

你们对如何解决这个问题有任何想法吗?

提前感谢您的支持。 最好的问候,

0 个答案:

没有答案