I've made this mistake many times. Fortunately, the fix is easy.
1. Press the "Preferences" button in the "Environment" section of the MATLAB Toolstrip
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/912020/image.png)
2. In the tree on the left of the Preferences dialog, select "MATLAB" -> "General" -> "Confirmation Dialogs":
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/912025/image.png)
3. On the right, check the box next to "Prompt when editing files that do not exist."