0

I have inadvertently messed around with my matlabroot folder and now some functionality is broken. How do I reset the state of the folder so that everything works again?

While trying to solve this question, I added a new method (nansubset.m) to the @table folder ([matlabroot,'\toolbox\matlab\datatypes\@table\*']). That did not work so I deleted it and moved it to my Matlab path as suggested by @TroyHaskin's answer. Everything worked fine until I restarted Matlab. Now I am getting the error message:

Error using table/nansubset
Previously accessible file "C:\Program
Files\MATLAB\R2015b\toolbox\matlab\datatypes\@table\nansubset.m" is now inaccessible.

I have tried clear classes and clear java and restarting Matlab, to no avail.

EDIT: I also found this link on the Mathworks site, which led me to doc toolbox_path_cache that in turn suggests using rehash toolboxcache. I did this and now there is a new error message:

Error using table/nansubset
Method 'nansubset' is not defined for class 'table' or is removed from MATLAB's search path.

However, which nansubset returns the right file from a directory on my Matlab path.

Community
  • 1
  • 1
Alex
  • 15,186
  • 15
  • 73
  • 127

1 Answers1

0

I have fixed my problem. Essentially, following the instructions from here, we are led to the helpfile for toolbox_path_cache, which states:

When you add or remove files in matlabroot/toolbox folders by some other means, MATLAB might not recognize those changes.

...

Update the cache so MATLAB recognizes the changes you made in matlabroot/toolbox folders.

To update the cache, type rehash toolbox and rehash toolboxcache. After this, it was necessary to restart Matlab to fix the problem

Alex
  • 15,186
  • 15
  • 73
  • 127