700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > matlab登录界面密码 关于MATLAB中密码登录界面的问题

matlab登录界面密码 关于MATLAB中密码登录界面的问题

时间:2021-08-16 10:55:54

相关推荐

matlab登录界面密码 关于MATLAB中密码登录界面的问题

长见识了!

我这个就是实现用密码登录,提示错误是

??? Error using ==> feval

Undefined function or method 'entersys_WindowButtonDownFcn' for input arguments of type 'struct'.

Error in ==> gui_mainfcn at 96

feval(varargin{:});

Error in ==> entersys at 44

gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating figure WindowButtonDownFcn

另外跳出提示“用户名或密码错误”的窗口,而且密码没有用 * 显示出来。

读密码的代码是

handles.output = hObject;

[num txt raw]=xlsread('userinf.xls');

if ~iscellstr(raw)

for i=1:numel(raw)

n(i)=isnumeric(raw{i});

end

raw{n}=num2str(raw{n});

end

handles.user=raw(2:end,1)';

handles.code=raw(2:end,2)';

guidata(hObject, handles);

判断密码的是

c = get(hObject,'Currentcharacter');

if isstrprop(c,'graphic')

set(hObject, 'userdata', [get(hObject,'userdata') c])

set(handles.userpassword, 'string', [get(handles.userpassword,'string') '*'])

else

val = double(c);

if ~isempty(c)

switch val

case 13

%判断对错

user = get(handles.username,'string');

code = get(gcf, 'userdata');

users = handles.user;

codes = handles.code;

n = find(strcmp(users,{user}));

if length(n) && isequal(codes{n}, code)

h = msgbox('登陆成功!');

uiwait(h);

delete(gcf);

lightdesign;

else

errordlg('用户名或密码错误!', '错误提示');

set(handles.userpassword, 'string', '')

set(hObject, 'userdata', '')

end

case 8

str = get(hObject, 'userdata');

if ~isempty(str)

str(end) = [];

end

set(hObject,'userdata',str)

str2 = get(handles.userpassword,'string');

if ~isempty(str2)

str2(end) = [];

end

set(handles.userpassword,'string',str2)

end

end

end

[本帖最后由 creatfnc 于 -11-11 09:34 编辑]

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。