How do I launch a web browser or an .html file through MATLAB?

88 views (last 30 days)
I want to launch a web browser or an .html file through MATLAB.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 May 2018
You can launch a web browser or an .html file through MATLAB either by using the WEB command or the DOS command. Here are two ways to launch a web browser using MATLAB:
1. The WEB Command
This launches the URL or html file in the default browser for MATLAB - not Internet Explorer or Netscape, but the browser shipped with MATLAB. The WEB command launches the URL in this browser window. For more information, refer to the MATLAB documentation, using either
help web
doc web
at the MATLAB command prompt.
2. Using DOS commands through MATLAB.
The following example launches a new window every time a URL or an html file is called:
dos('explorer test.html');
The following example uses the same explorer window to launch a URL or an html file:
dos('start D:\Applications\Matlab_R12.1\help\search1.html');
The following example shows how to dynamically generate a URL from MATLAB variables and launch it in the browser:
googleSubSite = {'shopping','wallet','finance'};
% launch 3 browser windows or tabs
for i = 1:3
dos(['start' googleSubSite{i}])
If you are planning to launch a web browser through stand-alone code generated using MATLAB, use the DOS command and not the WEB command. (The WEB command uses objects, which are not supported when compiling with the MATLAB compiler.)

More Answers (1)

Suresh Nama
Suresh Nama on 16 May 2018
You can open your default browser in MATLAB using the following command....

Community Treasure Hunt

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

Start Hunting!