Modal is not the same thing as "blocking execution". A modal dialog box prevents the user from interacting with other windows before responding, but does not prevent the remaining code in the MATLAB function from executing. MSGBOX is intended to put up a window containing information, and the "OK" button signifies that a person has seen the information. However, the dialog box does not suspend execution of a MATLAB function until user input.
To have a MATLAB function wait for something to happen before continuing to execute, you can either use a different type of dialog box like QUESTDLG, which is blocking, or you can use the WAITFOR command in conjunction with MSGBOX, which causes MATLAB to block execution until the graphics object is closed.
waitfor(msgbox('Wait for me.'));
will display 'Done waiting' only after the OK button in the MSGBOX has been clicked.