This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Open Web page or file in browser


  • stat = web(___)
  • [stat,h] = web(___)
  • [stat,h,url] = web(___)


web opens an empty MATLAB® Web browser.


web(url) opens the page specified by url in the MATLAB Web browser. If multiple browsers are open, the page displays in the one that was most recently used.


web(url,opt) opens the page using the specified browser option, such as '-new' to create a new browser instance or '-browser' to use the system browser.


web(url,opt1,...,optN) opens the page using one or more browser options.

stat = web(___) returns the status of the operation: 0 if successful, 1 or 2 if unsuccessful. You can include any of the input arguments in previous syntaxes.


[stat,h] = web(___) returns a handle to a MATLAB Web browser that allows you to close it using the command close(h). If you do not specify any inputs to the web function, such as [stat,h] = web, then the handle corresponds to the most recently used MATLAB Web browser.

[stat,h,url] = web(___) returns the URL of the current page in the MATLAB Web browser.


collapse all

Open the MathWorks® Web site home page.

url = '';

Open the page in a new instance of the browser that does not include a toolbar.


View an HTML file that resides on your system.

Create an HTML file by publishing an example program file. Copy the program file to the current folder so that the code can run during the publishing process.

program = fullfile(matlabroot,'help','techdoc',...
htmlFile = publish('fourier_demo2.m');

View a file by specifying the file name.


Alternatively, you can use the file:/// URL scheme, as long as you include the full path. The publish function returns the path in the htmlFile output.

url = ['file:///',htmlFile];

Open the MathWorks® Web site home page in the system browser.

url = '';

Send an email from your system browser's default mail application using the mailto: URL scheme.

To run this example, replace the value for email with a valid email address.

email = 'myaddress@provider.ext';
url = ['mailto:',email];

Open the MathWorks® Web site home page, and then close the browser using its handle.

url = '';
[stat,h] = web(url);

Close the browser window.


View formatted text using the text:// URL scheme.

web('text://<html><h1>Hello World</h1></html>')

Input Arguments

collapse all

Web page address or file location, specified as a character vector. File locations can include an absolute or relative path.

If url corresponds to a file in the installed product documentation, then the page displays in the MATLAB Help browser instead of the Web browser.

Example: 'http:\\'

Example: 'myfolder/myfile.html'

Browser option, specified as one of the following. Options can appear in any order.


Opens the page in a system browser window instead of the MATLAB Web browser. On Microsoft® Windows® and Apple Macintosh platforms, the operating system determines the system Web browser. On other systems, the default is the Mozilla® Firefox® browser, but you can change the default using MATLAB Web preferences.


Opens the page in a new MATLAB Web browser window. Does not apply to the system browser.


Opens the page in a browser that does not display the address box. Only applies to new instances of the MATLAB Web browser.


Opens the page in a browser that does not display a toolbar or address box. Only applies to new instances of the MATLAB Web browser.

Example: '-new','-noaddressbox'

Output Arguments

collapse all

Browser status, returned as an integer with one of these values:


Found and launched system browser.


Could not find system browser.


Found, but could not launch system browser.

Handle to the most recent MATLAB Web browser, returned as a scalar instance of the associated Java® class.

If you do not request the handle when you open the page, be aware that this handle might not correspond to your most recent use of the web function. Other MATLAB functionality also uses the web function, such as links to external sites from the Help browser.

Current page address in the most recent MATLAB Web browser, returned as a character vector.

More About

collapse all


  • If you plan to deploy an application that calls the web function using the MATLAB Compiler™ product, then use the '-browser' option.

  • If you are displaying Japanese streaming text in the MATLAB Web browser, specify a header that includes the charset attribute. For example:

    web(['text://<html><head><meta http-equiv="content-type" ' ...

Introduced before R2006a

Was this topic helpful?