我怎样才能发出倒计时的大消息?软件
How can I make a big message of countdown? MATLAB
我想制作 countdown.I 的大消息 找到了一种带有消息对话框的表单,但它比我想要的要小。
这是我已经证明的代码,但是它很小,我需要一个倒计时的大消息。
msgbox('3');
pause(1)
msgbox('2');
pause(1)
msgbox('1');
pause(1)
msbox('smile');
我该怎么做?
终于找到解决方法了
h = msgbox(' 3');
set(h, 'position', [500 300 100 100]); %makes box bigger
ah = get( h, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 70 ); %makes text bigger
pause(1)
h = msgbox(' 2');
set(h, 'position', [500 300 100 100]); %makes box bigger
ah = get( h, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 70 ); %makes text bigger
pause(1)
h = msgbox(' 1');
set(h, 'position', [500 300 100 100]); %makes box bigger
ah = get( h, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 70 ); %makes text bigger
pause(1)
您的示例中有很多冗余代码。这有点干净:
% Initialize our figure
fh = figure( ...
'MenuBar', 'none', ... % Get rid of unnecessary UI elements
'DockControls', 'off', ... % Get rid of unnecessary UI elements
'ToolBar', 'none', ... % Get rid of unnecessary UI elements
'Units', 'Pixels', ... % Makes it a bit easier to set position
'Position', [500 300 500 500] ... % Position, pixels [x, y, width, height]
);
% Initialize our text box
textbox = uicontrol( ...
'Parent', fh, ... % Put it in our figure window
'Style', 'text', ... % We want a text box
'Units', 'Normalized', ... % Scale the box relative to figure window
'Position', [0, 0, 1, 1], ... % Scale the box relative to figure window
'FontUnits', 'Normalized', ... % Scale font relative to text box
'FontSize', 0.8 ... % Scale font relative to text box
);
startnum = 10; % Our starting number
while startnum >= 0
set(textbox, 'String', startnum); % Update text box string
pause(1) % Wait 1 second
startnum = startnum - 1; % Subtract one from our counter
end
我想制作 countdown.I 的大消息 找到了一种带有消息对话框的表单,但它比我想要的要小。 这是我已经证明的代码,但是它很小,我需要一个倒计时的大消息。
msgbox('3');
pause(1)
msgbox('2');
pause(1)
msgbox('1');
pause(1)
msbox('smile');
我该怎么做?
终于找到解决方法了
h = msgbox(' 3');
set(h, 'position', [500 300 100 100]); %makes box bigger
ah = get( h, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 70 ); %makes text bigger
pause(1)
h = msgbox(' 2');
set(h, 'position', [500 300 100 100]); %makes box bigger
ah = get( h, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 70 ); %makes text bigger
pause(1)
h = msgbox(' 1');
set(h, 'position', [500 300 100 100]); %makes box bigger
ah = get( h, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 70 ); %makes text bigger
pause(1)
您的示例中有很多冗余代码。这有点干净:
% Initialize our figure
fh = figure( ...
'MenuBar', 'none', ... % Get rid of unnecessary UI elements
'DockControls', 'off', ... % Get rid of unnecessary UI elements
'ToolBar', 'none', ... % Get rid of unnecessary UI elements
'Units', 'Pixels', ... % Makes it a bit easier to set position
'Position', [500 300 500 500] ... % Position, pixels [x, y, width, height]
);
% Initialize our text box
textbox = uicontrol( ...
'Parent', fh, ... % Put it in our figure window
'Style', 'text', ... % We want a text box
'Units', 'Normalized', ... % Scale the box relative to figure window
'Position', [0, 0, 1, 1], ... % Scale the box relative to figure window
'FontUnits', 'Normalized', ... % Scale font relative to text box
'FontSize', 0.8 ... % Scale font relative to text box
);
startnum = 10; % Our starting number
while startnum >= 0
set(textbox, 'String', startnum); % Update text box string
pause(1) % Wait 1 second
startnum = startnum - 1; % Subtract one from our counter
end