📄 message.m
字号:
function h0=message(opt,msg1,msg2,hdl_msg)
%function h0=message(opt,msg1,msg2,hdl_msg)
% display a message in a popup window
% opt = 1 interactive mode
% 2 message only
% 3 change msg1 only
% 4 change msg2 only
% 5 chnage all message
% msg1 first line of the message
% msg2 second line of the mesage
% hdl_msg handle
light_grey=[0.80 0.80 0.80];
if opt < 3
h0 = figure('Color',[0.8 0.8 0.8], ...
'Units','normalized', ...
'Position',[0.1 0.2 0.4 0.3]);
set(gcf,'menubar','none');
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
'BackgroundColor',light_grey, ...
'Position',[0.1 0.5 0.8 0.4], ...
'String',msg1, ...
'fontsize',10, ...
'Tag','Message1', ...
'Style','Text');
set(h1,'foregroundcolor',[0 0 1],'fontweight','bold','HorizontalAlignment','left');
if opt == 1
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
'Callback','close', ...
'FontSize',9, ...
'FontWeight','bold', ...
'Position',[0.80 0.1 0.1 0.1], ...
'String','Quit', ...
'Tag','QuitMessage');
msg2=' ';
end
if nargin > 2 | opt == 1
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
'BackgroundColor',light_grey, ...
'Position',[0.1 0.2 0.8 0.2], ...
'String',msg2, ...
'fontsize',10, ...
'Tag','Message2', ...
'Style','Text');
set(h1,'HorizontalAlignment','left');
end
elseif opt == 3
h1=findobj(hdl_msg,'Tag','Message1');
set(h1,'string',msg1,'HorizontalAlignment','left');
elseif opt == 4
h1=findobj(hdl_msg,'Tag','Message2');
set(h1,'string',msg1,'HorizontalAlignment','left');
elseif opt == 5
h1=findobj(hdl_msg,'Tag','Message1');
h2=findobj(hdl_msg,'Tag','Message2');
set(h1,'string',msg1,'HorizontalAlignment','left');
set(h2,'string',msg2,'HorizontalAlignment','left');
end
drawnow
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -