How to set proxy server information for "webread" and "webwrite" via GUI and programmatically?

I am using the "webread" and "webwrite" functions in MATLAB and need to connect through a proxy server.
How can I configure proxy settings using the MATLAB desktop (GUI) and programmatically (including in a deployed application)?

 Accepted Answer

MATLAB supports configuring proxy settings through the desktop preferences and, for deployed workflows, programmatically in code.
GUI-based proxy configuration (MATLAB desktop)
Please see the instructions on how to configure proxy settings
Programmatic proxy configuration (deployed application)
  1. Configure the proxy in the MATLAB GUI first.
  2. Compile the application for deployment.
    • The proxy preference values may be carried into the compiled application by default.
If the compiled application does not pick up the proxy settings, set the proxy information programmatically before calling "webread" (and similarly before "webwrite") when running deployed:
if isdeployed
com.mathworks.mlwidgets.html.HTMLPrefs.setUseProxy(true)
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyHost('HostName')
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyPort('Port')
% If proxy authentication is required
com.mathworks.mlwidgets.html.HTMLPrefs.setUseProxyAuthentication(true)
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyUsername('test')
com.mathworks.mlwidgets.html.HTMLPrefs.setProxyPassword('test')
end

More Answers (0)

Categories

Find more on Application Deployment in Help Center and File Exchange

Products

Release

R2025b

Community Treasure Hunt

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

Start Hunting!