📄 amortsched_cb.m
字号:
function amortsched_cb(action)
%AMORTSCHED_CB Callback routines for AMORTSCHED.
% $Revision: 1.2 $ $Date: 2000/06/23 14:36:35 $
% Copyright 1984-2000 The MathWorks, Inc.
switch action
case 'clear_values'
principal_h = findobj(gcbf,'tag','principal_tag');
ir_h = findobj(gcbf,'tag','ir_tag');
ppy_h = findobj(gcbf,'tag','ppy_tag');
noy_h = findobj(gcbf,'tag','noy_tag');
set([principal_h ir_h ppy_h noy_h],'String','')
clear principal_h ir_h ppy_h noy_h
case 'calculate_values'
principal_h = findobj(gcbf,'tag','principal_tag');
ir_h = findobj(gcbf,'tag','ir_tag');
noy_h = findobj(gcbf,'tag','noy_tag');
ppy_h = findobj(gcbf,'tag','ppy_tag');
principal = str2num(get(principal_h,'String'));
ir = str2num(get(ir_h,'String'));
ppy = str2num(get(ppy_h,'String'));
noy = str2num(get(noy_h,'String'));
if isempty(principal) | isempty(ir) | ...
isempty(noy) | isempty(ppy)
errordlg('Failed to supply all values!','Calculate','modal')
return
end
if (ir < 0) | (ppy < 0) | (noy < 0)
errordlg(...
'Rate, Payments/Year, and Number of Years must be >= 0.',...
'Loan Schedule',...
'modal')
return
end
total_nop = ppy*noy;
[princp, intp, bal, p] = loansched(ir/(ppy*100), total_nop, principal);
x.data = [princp' intp' bal'];
x.rowheader = {'Period'};
x.collabels = {'Principal';'Interest';'Balance'};
x.top = 250;
x.left = 350;
datagrid(x, gcbf);
clear principal_h ir_h ppy_h noy_h principal ir noy total_nop x
case 'close_amortsched'
close('force','Amort Sched 1.0')
if isruntime
exit
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -