Windows actually has an API that enables a process that has a window to block a system shutdown indefinitely until the user manually chooses what to do next. (possibly, as @josh3736 pointed out, Windows Update may break this eventually. But I personally have not experienced a concrete case of it. At least it should be safe to block a shutdown when you sleep until you wake up, and then you just click cancel to cancel the shutdown)

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-shutdownblockreasoncreate

ShutdownBlockReasonCreate function (winuser.h) Indicates that the system cannot be shut down and sets a reason string to be displayed to the user if system shutdown is initiated.

Note that calling this alone cannot block a shutdown/restart successfully. You also need your application to handle the WM_QUERYENDSESSION and WM_ENDSESSION messages. I will discuss them at the end.

If you are not a developer so you do not know how to use Windows API, you can use a small program that I have written years ago for exactly the same purpose: https://github.com/real-guanyuming-he/ShutdownBlocker

Either way, when you have successfully created a shutdown block reason, Windows will pause when a shutdown (including an update restart) is issued, and display this to you, where you can click Cancel to cancel the shutdown.

Note: If you have no control over your Matlab simulations program (I do not use Matlab so I do not know if it is possible), then it might or might not work, depending on how Matlab handles the situation. According to Microsoft (https://learn.microsoft.com/en-us/windows/win32/shutdown/shutting-down),

Applications with a window and message queue receive shutdown notifications through the WM_QUERYENDSESSION and WM_ENDSESSION messages. These applications should return TRUE to indicate that they can be terminated.