How to get MATLAB to reload its cached internal m-files

I need to change the publish.m file ([matlabroot]/toolbox/matlab/codetools/publish.m) to make the font size of published equations somewhat bigger. I used to do it in previous versions of MATLAB and it worked successfully, but in 2015a it seems that the change isn't noticed.
I've tried restarting MATLAB or running clear publish to no avail.
Do you know how I can make MATLAB recognize the change?

 Accepted Answer

It's a bit of a tedious method, but it works. Basically, you run MATLAB as administrator, navigate to .../toolbox/matlab/codetools/, edit the publish.m file, and then run
pcode publish.m
This will regenerate the publish.p in that folder (it must exist, and MATLAB only reads that file). Just note that if you also have a non-admin instance of MATLAB open at the same time that you're using for publishing, you should run
clear all
or at least
clear publish
every time you make edits to the .m file and regenerate the .p file (MATLAB will cache the version of the .p file that existed when you opened that instance, unless you force-clear it).
Edit (10/11/15): Based on the comment below by Walter Roberson, and which I have confirmed on Windows, it is sufficient to run
rehash toolboxcache
after making changes.

3 Comments

In OS-X I see no indication that MATLAB has a publish.p -- it appears to be relying upon the .m file.
rehash toolboxcache
Thanks, it worked! and it was not at all tedious :)
@Walter Roberson your method does indeed work on Windows. Editing my answer.

Sign in to comment.

More Answers (0)

Categories

Products

Asked:

on 24 Apr 2015

Edited:

on 11 Oct 2015

Community Treasure Hunt

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

Start Hunting!