File is not found in current folder or on the Matlab path.

646 views (last 30 days)
Hi guys! I have the same problem with any new script I’d like to run: Every time I run a new Script Matlab wants me to „Change Folder“ or „Add to Path“. I can click on either of those buttons but nothing changes. I also tried to change the Path by the „Set Path“ button in the home menu and it has the same outcome. I hope you guys can help me!

Answers (2)

Ankit
Ankit on 3 May 2023
Hello! It sounds like there may be an issue with your MATLAB path settings. Here are a few things you can try:
  1. Check your current path: Click on the "Set Path" button in the MATLAB home menu and check if the current path includes the folder where your script is saved. If not, you can add the folder to the path by clicking on the "Add Folder" button.
  2. Save your script in a default folder: You can try saving your script in the default MATLAB folder (usually "Documents/MATLAB") and see if that resolves the issue.
  3. Check your startup settings: MATLAB may be starting up with a default path that is causing the issue. To check this, go to the "Preferences" menu and click on "MATLAB" on the left-hand side. Then, click on "Startup" and make sure that the "Start Folder" is set to a default MATLAB folder.
  4. Restart MATLAB: Sometimes, simply restarting MATLAB can resolve path-related issues.
If none of these solutions work, you may want to contact MATLAB support for further assistance.

Image Analyst
Image Analyst on 3 May 2023
You get that message when the m-file you're in, in the editor, and trying to run, does not live in the "Current folder" shown in the panel to the left. I always click "Change folder". You should be OK then. If you don't want to see that then right click on the name of the file (the tab) and select "Change folder to whatever" and it will change the folder before it runs the file.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!