pb_change.m
来自「matlab从入门到精通第13章书后源码对初学者很有帮助」· M 代码 · 共 30 行
M
30 行
function pb_change(pb_htable,name)
% 改变电话本中的记录
% 如果找到用户,那么通过else块来显示
entry = pb_htable.get(pb_keyfilter(name));
if isempty(entry)
disp(sprintf('The name %s is not in the phone book', name));
return;
else
pb_display(entry);
r = input('Replace phone numbers in this entry (y/n)? ','s');
if r ~= 'y'
return;
end;
end;
% 输入新的电话号码
disp 'Type in the new phone number(s), one per line.'
disp 'To complete the entry, type an extra Enter.'
disp(sprintf(':: %s', name));
entry=[name '^'];
while 1
line = input(':: ','s');
if isempty(line)
break;
else
entry=[entry line '^'];
end;
end;
pb_htable.put(pb_keyfilter(name),entry);
disp ' '
disp(sprintf('The entry for %s has been changed', name));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?