Search code examples
matlabmsgbox

Matlab Warning: Invalid string for Icon in MSGBOX


I'm using the msgbox command to Show some Information for a short period of time.

handle = msgbox(sprintf('Trucks: %d',nT),'Fontsize',12);
pause(1)
delete(handle);

Doing this Matlab shows me the following warning:

Warning: Invalid string for Icon in MSGBOX. 

Why is this string invalid? The Msgbox actually pops up and even shows the string perfectly. Any ideas?

Thank you !


Solution

  • In order to Alex K.'s comment, I want to show how I delete the warning but still changing the fontsize in the msgbox:

    handle = msgbox(sprintf('Cars: %d',nC));
    txt = findobj(handle,'Type','text'); 
    set(txt,'Fontsize',20); 
    pause(1)
    delete(handle);
    

    The msgbox is shown for 1 second with fontsize 20 and after will be deleted.