Main Content

matlab.htmlviewer.HTMLViewer

HTML Viewer tab

Since R2025a

    Description

    The matlab.htmlviewer.HTMLViewer class represents an HTML tab open in the HTML Viewer.

    Creation

    When you use the web function to open a local URL or file, the function returns a matlab.htmlviewer.HTMLViewer object.

    Properties

    expand all

    Last specified input for the HTML Viewer tab, specified as a string scalar. If you open a tab using the web function without specifying an input, Input is empty.

    Whether the contents of the HTML Viewer tab are visible, specified as a numeric or logical 1 (true) or 0 (false). Set this property to false to hide the contents of the HTML Viewer tab and show a blank page instead. Set this property to true to show the contents of the HTML Viewer tab and bring focus to the tab.

    Object Functions

    getHTMLTextGet contents of HTML Viewer tab

    Examples

    collapse all

    Create a local HTML file by publishing an example program file.

    htmlFile = publish("penny.m",outputDir=pwd);

    View the file in the HTML Viewer using the web function by specifying the filename. The web function returns the status of the operation and a handle to the HTML Viewer tab.

    [stat,h] = web(htmlFile);

    Set the Visible property to hide the contents of the HTML Viewer tab.

    h.Visible = false

    Version History

    Introduced in R2025a