MATLAB: Is there command line functionality to refresh the Help Navigator ‘Contents’ after editing ‘helptoc.xml’

contentshelphelpindexhelpindex.xmlhelpsearchhelpsearch.dbhelptochelptoc.xmlMATLABnavigator

I am trying to add documentation for a toolbox I have created, and integrate it with the Help Navigator.
I wish to be able to refresh the Help Navigator 'Contents' after editing 'helptoc.xml'. One way of doing this is in MATLAB is to press Start -> Desktop Tools -> View Source Files, and then click "Refresh Start Button" in the resulting Start Button Configuration Files dialog box. Is there equivalent command-line functionality?

Best Answer

The "Refresh Start Button" functionality is not written in MATLAB code, and so there is no direct command-line equivalent.
To work around this issue, remove the directory containing the documentation from the path (using RMPATH), and then add it back (using ADDPATH). The toolbox documentation will disappear from the Help Navigator 'Contents' after issuing the RMPATH command, and then the updated version will reappear in the Help Navigator 'Contents' after issuing the ADDPATH command. An example:
rmpath('C:\...')
addpath('C:\...')
Two notes of importance:
1. ADDPATH only provides flags '-begin' and '-end' to add to the top or bottom of path. Reinserting to a specific position in the path requires the sequence:
p = rmpath('C:\...');
path(p);
The first command saves the path (prior to removing the specified directory) in the variable 'p', and the second command restores the path to the prior saved version stored in the variable 'p'.
2. Path changes using RMPATH and ADDPATH are only made to the current MATLAB session. Saving the current MATLAB session's path in the "pathdef.m" file, which is read on startup, requires issuing the SAVEPATH command.