function dummy = refreshmargin(Editor)
%REFRESHMARGIN  Dynamic update of stability margins in Bode Editor.

%   Authors: P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.3 $  $Date: 2000/06/14 20:19:42 $

% REVISIT
dummy = [];

% Quick exit if margins off
if strcmp(Editor.MarginVisible,'on'),
    % Interpolate stability margins 
    Magnitude = Editor.Magnitude * abs(getgain(Editor.LoopData));
    [Gm,Pm,Wcg,Wcp] = imargin(Magnitude(:),Editor.Phase(:),Editor.Frequency(:));
    
    % Update display
    showmargin(Editor,...
        struct('Gm',Gm,'Pm',Pm,'Wcg',Wcg,'Wcp',Wcp,'Stable',NaN));
end