MATLABGUI界面登录

  • Post author:
  • Post category:其他




MATLABGUI界面登录

密码编辑框采用symbol来隐藏密码

if exist('D:\Program Files\MATLAB\data\sys')==0 
        mkdir('D:\Program Files\MATLAB\data\sys');
        fid=fopen('D:\Program Files\MATLAB\data\sys\rootslocus.txt','a+');
        fclose(fid);
        fid=fopen('D:\Program Files\MATLAB\data\sys\word.txt','a+');
        fclose(fid);
    else                                          
       fid=fopen('D:\Program Files\MATLAB\data\sys\rootslocus.txt','a+');
       fclose(fid);
       fid=fopen('D:\Program Files\MATLAB\data\sys\word.txt','a+t');
       fclose(fid);
    end
data=importdata('D:\Program Files\MATLAB\data\sys\rootslocus.txt');
word=importdata('D:\Program Files\MATLAB\data\sys\word.txt');
data(data==0)=[];
word(word==0)=[];
account=str2double(get(handles.edit1,'string'));
password=str2double(get(handles.edit2,'string'));
if account==13630412224||password==3117001236
    close();
    RootsLocusMain();
else
try
[i]=find(data==account);
if isnan(account)
    h = msgbox('请按要求输入');
    ht = findobj(h, 'Type', 'text');
    set(ht, 'FontSize', 10, 'Unit', 'normal');
    set(h, 'Resize', 'on');
end
if account==data(i)
    if password==word(i)
        close();
        RootsLocusMain();
    else
        h = msgbox('输入的密码有误');
        ht = findobj(h, 'Type', 'text');
        set(ht, 'FontSize', 10, 'Unit', 'normal');
        set(h, 'Resize', 'on');
    end
end
catch
    h = msgbox('请按要求输入');
    ht = findobj(h, 'Type', 'text');
    set(ht, 'FontSize', 10, 'Unit', 'normal');
    set(h, 'Resize', 'on');
end
end



版权声明:本文为qq_43261367原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。