I am using this code in MATLAB 7.11 (R2010b) to create a infobox:
function g = infobox(text, header, notneeded) if nargin < 2 header = 'Info box'; end relWidth = 0.5; relHeight = 0.1; screenSize = get(0, 'ScreenSize'); height = min(1.1*1024, screenSize(4)); width = min(1.1*1280, screenSize(3)); % Position of is relative to screen resolution
pos = [width*(1-relWidth)/2, height*(1- relHeight)/2, ... width*relWidth, height*relHeight]; gColor = [0.92941 0.94118 0.9451]; g = figure('NumberTitle', 'off', ... 'MenuBar', 'none', ... 'Resize', 'off', ... 'Name', header, ... 'Color', gColor, ... 'Position', pos, ... 'WindowStyle', 'modal'); set(g,'HandleVisibility','off') pp = getpixelposition(g); uicontrol(g, 'Style', 'text', ... 'String', text,... 'HorizontalAlignment', 'left', ... 'BackgroundColor', get(g,'Color'),... 'FontName', 'Calibri', ... 'FontSize', 14,... 'Position', [0.1*pp(3) 0.05*pp(4) 0.8*pp(3) 0.9*pi(4)]); pause(1) end
This infobox should close after a while but this does not work:
infobox('test');close(gcf)
Best Answer