function unlockCftool()
% NOTES:
% 1) After unlocking cftool, it will no longer update the list of workspace variables, so
% make sure all desired variables exist in the base workspace before proceeding, or you'll
% need to restart cftool.
% 2) DO NOT execute this code while debugging, since then the variable selection fields in
% cftool will be stuck in their disabled mode until it is restarted.
hSFT = getappdata( groot, 'SurfaceFittingToolHandle' );
jEFP = hSFT.FitFigures{1}.HFittingPanel.HUIPanel.Children.java.getJavaPeer();
f = jEFP.getClass().getDeclaredField('fittingDataPanel');
f.setAccessible(true);
jFDP = f.get(jEFP);
f = jFDP.getClass().getDeclaredFields(); f = f(1:4); % <- shortcut for:
%{
f = [jFDP.getClass().getDeclaredField('fXDataCombo');
jFDP.getClass().getDeclaredField('fYDataCombo');
jFDP.getClass().getDeclaredField('fZDataCombo');
jFDP.getClass().getDeclaredField('fWDataCombo')];
%}
java.lang.reflect.AccessibleObject.setAccessible(f, true);
for ind1 = 1:numel(f)
f(ind1).get(jFDP).cleanup();
end
所以现在我们可以做以下的事情:
X = 0:9;
Y = 10:-1:1;
cftool();
% <select the X and Y variables in cftool to get a decreasing slope>.
unlockCftool();
% <enter debug mode, for example using: dbstop in unlockCftool; unlockCftool(); >
assignin('base', 'X', 5:-1:-4);
% <re-select X to update the data - resulting in a rising slope>.