Problem in savepath in MATLAB 2025B
39 views (last 30 days)
Show older comments
In MATLAB R2025b, I am encountering an unexpected runtime error when executing a very simple script from the MATLAB path.
I add the folder containing my .m file to the MATLAB path using savepath, which allows the script to be executed from any working directory. This workflow has worked correctly in all previous MATLAB versions.
However, in R2025b only, executing the script from outside its folder results in the following exception, even though the script contains only a single line:
filename = 'data_v1.csv';
The error message is:
Caught "std::exception" Exception message is:
Unexpected mxArray type returned from feval. Expected class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > but found string.
There are no calls to feval, no functions, and no toolbox dependencies in the script.
The issue disappears if:
- All user paths are removed and the script is run from its own directory, or
- The script is moved out of the MATLAB path and executed locally.
For additional context, the .m file is located in a Dropbox-synchronized folder.
This behavior has never occurred in earlier MATLAB releases and appears to be specific to R2025b. Is this a known regression related to path-based execution, string/char handling, or cloud-synced directories?
1 Comment
Angelo Yeo
on 15 Jan 2026 at 3:08
I assume something got corrupted in your settings and/or paths. Please follow the initial troubleshooting steps below:
===
1. Reset MATLAB path
Before modifying the search path, it is important to take a backup of your 'pathdef.m' file, which can be located by using the command:
>> which -all pathdef
Before proceeding, ensure that you make a safe copy of the file by copying it to a folder outside of your MATLAB path.
After taking the backup, please execute the following commands in the MATLAB Command Window to restore the default MATLAB/Simulink search path and rehash the toolbox cache:
>> restoredefaultpath
>> rehash toolboxcache
>> sl_refresh_customizations
After this step, please use MATLAB to see if the issue occurs again. If the issue is resolved, then you may want to save the new MATLAB search path by executing the following command:
>> savepath
NOTE: This will remove any custom paths you may have created. The following MATLAB Answers post is an additional resource on how to back them up:
2. Regenerate preferences
Please follow the instructions in this link:
===
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Search Path 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!