Prevent MATLAB from creating empty mfile if it doesn't exist

I would like to turn off the following behavior: When I try to open a mfile that doesn't exist as far as MATLAB knows*, MATLAB creates an empty mfile with that name in the present directory and opens it. Instead, when I try to open a non-existing file I would like MATLAB to return an error with no new file created. What setting do I have to change?
*Example of when this happens: I am editing mfile1 which calls mfile2. I don't realize mfile2 is not on my path. In mfile1's editor I use CNTRL-D to try and open mfile2. Since mfile2 is not on my path, it doesn't open: instead a new blank mfile2.m is created in the current directory and opened in the mfile editor.

 채택된 답변

Stephen23
Stephen23 2017년 1월 13일
편집: Stephen23 2017년 1월 14일

6 개 추천

After CTRL+D you click "no" instead of "yes":
If at some point in the past you have checked the box "Do not show this prompt again", then the moral of the story is always remember what you yourself have chosen.
This page explains how to reset that checked box:
Basically you need to check this box in the preferences:
:

댓글 수: 1

I have only had this seat of MATLAB 1 day, but clearly that was long enough to have made a wrong choice! Thanks for the guidance on settings.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

the cyclist
the cyclist 2017년 1월 13일
편집: the cyclist 2017년 1월 13일

1 개 추천

If you are doing this programmatically, then you can use the exist command to see if the file is there.

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

질문:

KAE
2017년 1월 13일

편집:

2017년 1월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by