メインコンテンツ

exportView

R2026b

Export wireless network visualization as image file

Since R2026b

    Description

    exportView(networkViewer) opens a file dialog to specify the file name and location, then exports the network visualization from the wireless network viewer object viewer as an image file.

    exportView(networkViewer,Name=Value) sets additional options using name-value arguments. For example, FileName="myNetwork.png" specifies to save the visualization as myNetwork.png in the current working directory.

    example

    Examples

    collapse all

    Generate and visualize the random placement of wireless nodes within a rectangular area. Using the nodePositionRandom function, you distribute ten nodes uniformly inside a 100-by-100 meter region. Then, a wirelessNetworkViewer object displays the resulting node positions.

    Set the area dimensions and number of nodes.

    areaLength = 100;           % Rectangle length (meters)
    areaWidth = 100;            % Rectangle width (meters)
    numNodes = 10;              % Number of random nodes

    Generate random node positions in the rectangle.

    [nodePositions,rectPoly] = nodePositionRandom( ...
        "rectangle",[areaLength areaWidth],NumNodes=numNodes);

    View the positions using the wireless network viewer.

    viewer = wirelessNetworkViewer(CanvasSize=[200 200]);
    addNodes(viewer,nodePositions,Type="RandomNodePositions")

    Show the rectangle boundary.

    showBoundary(viewer, ...
        Position=[0 0 0], ...
        BoundaryShape="rectangle", ...
        Bounds=[areaLength areaWidth], ...
        Name="RectangleBoundary")

    Figure Wireless Network Viewer contains an axes object. The axes object with xlabel X-axis (m), ylabel Y-axis (m) contains 22 objects of type line. One or more of the lines displays its values using only markers These objects represent Canvas Boundary, RandomNodePositions, Boundary.

    Export the visualization as an image file by uncommenting this line of code.

    % exportView(viewer,FileName="myNetwork.png")

    Remove the node position by uncommenting this line of code.

    % removeNodes(viewer)

    Hide the rectangle boundary by uncommenting this line of code.

    % hideBoundary(viewer)

    Input Arguments

    collapse all

    Wireless network viewer, specified as a wirelessNetworkViewer object.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: FileName="myNetwork.png" specifies to save the visualization as myNetwork.png in the current working directory.

    Name of the image file, specified as a string scalar or character vector. If you do not specify a file name, the function opens a file dialog.

    Supported image formats include PNG, JPG, and other formats returned by the imformats function. If you do not provide the file extension, the function appends .jpg by default.

    Data Types: string | char

    Directory path where you save the image file, specified as a string scalar or character vector.

    Data Types: string | char

    Version History

    Introduced in R2026b