MATLAB: Change preferences by command line

change preferencescommand linejavanot_enough_detailsundocumented

Dear all,
I would like to change some Matlab preferences (the ones that you reach from the "file" menu) from the command line. I found on the newsgroup some undocumented Java commands to change them (described by Yair Altman, thanks a lot), i.e.:
edit(fullfile(prefdir,'matlab.prf')); com.mathworks.services.Prefs.setStringPref('HTMLProxyHost','XX.XXX.XX.XX'); com.mathworks.services.Prefs.setStringPref('HTMLProxyPort','X');
However those commands do not work immediately, but Matlab need to be restarded to change them. Does anyone know a way to change them immediately, without restarting Matlab?
Thanks a lot! Cheers, Manfredo

Best Answer

Do you want to change the preferences, or do you just want to define a proxy manually? For the later, you could try this (I cannot test it):
M = com.mathworks.net.transport.MWTransportClientPropertiesFactory.create();
methods(M)
EDITED: Perhaps this way - but I cannot test it, because my Matlab computer has no connection to the net.
M.setProxyUser(java.lang.String('User'));
M.setProxyPassword(java.lang.String('Password'));
M.setProxyHost(java.lang.String('Host'));
M.setProxyPort(java.lang.String('Port'));
Related Question