You need to replace the actual request to close the window with something βinertβ. The following code should do what you want:
figure('CloseRequestFcn', @(h,e) fprintf(1, 'Not allowed, use "close %d force"\n.', h));
Please note that this will not make it impossible: this will prevent accidental closing of the window, but if your colleagues make practical jokes about how to mess with your work, then this must be decided at the person level, and not at the programming level.
user2271770
source
share