messagebox which, when closed, ends the program in matlab
You can use the built-in msgbox function in MATLAB and add an error statement beneath it. This will cause the program to terminate once the message box is closed. Here's an example:
main.m
msgbox('Message to display', 'Title of message box', 'modal');
error('Program terminated by user.');