function f = mpcgetblockdialog(blkh)
%Check if Simulink is installed.

% Author(s): Rong Chen
% Copyright 1986-2013 The MathWorks, Inc. 

oldsh = get(0,'ShowHiddenHandles');
set(0,'ShowHiddenHandles','on');
if strcmp(get_param(blkh,'MaskType'),'MPC')
    fig = findobj('Type','figure','Tag','MPC_mask');
else
    fig = findobj('Type','figure','Tag','MPC_mask_multiple');
end
set(0,'ShowHiddenHandles',oldsh);
if isempty(fig)
    f = [];    
else
    f = findobj(fig,'flat','UserData',blkh);
end
