How do I set a proxy server to use with the URLREAD and URLWRITE functions in MATLAB as of R2010b?

In R2010a as explained in the technical solution:
it was possible to use the following command:
jobj = com.mathworks.mlwidgets.html.HTMLPrefs;
As of R2010b, the same command returns the following error message:
??? No constructor 'com.mathworks.mlwidgets.html.HTMLPrefs' with matching signature found.
Which command do I have to use as of 10b?

 Accepted Answer

I have just found a workaround.
The following lines are from the above technical solution 1-19J5C: How do I set a proxy server to use with the URLREAD and URLWRITE functions in MATLAB? :
if isdeployed
jobj = com.mathworks.mlwidgets.html.HTMLPrefs;
setUseProxy(jobj,1)
setProxyHost(jobj,'HostName')
setProxyPort(jobj,'Port')
end
In fact we could write these lines as follows:
if isdeployed
com.mathworks.mlwidgets.html.HTMLPrefs.setUseProxy(true)
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyHost('HostName')
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyPort('Port')
end
And these lines work within R2010a and R2010b .

More Answers (1)

If one also want to set the Proxy Authentification, the following lines of code could be helpfull.
if isdeployed
com.mathworks.mlwidgets.html.HTMLPrefs.setUseProxyAuthentication(true) com.mathworks.mlwidgets.html.HTMLPrefs.setProxyUsername('proxyuser') com.mathworks.mlwidgets.html.HTMLPrefs.setProxyPassword('proxypassword')
end

Categories

Products

Community Treasure Hunt

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

Start Hunting!