メインコンテンツ

showBoundary

Create and visualize node placement boundary on canvas

Since R2026a

    Description

    showBoundary(networkViewer) creates and visualizes the node placement boundary on the wireless network viewer canvas.

    showBoundary(networkViewer,Name=Value) sets boundary configuration parameters using one or more optional name-value arguments. For example, Position=[0 1 3] sets the center position for the created boundary as [0 1 3].

    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.

    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: showBoundary(networkVisualizer,Position=[0 1 3]) sets the center position for the created boundary as [0 1 3].

    Center position for created boundary, specified as an N-by-3 matrix.

    Data Types: double

    Boundary shape, specified as "circle", "rectangle", or "hexagon".

    Dimensions of the boundary, specified as a numeric scalar or a two-element row vector. When you specify BoundaryShape as "circle" or "hexagon", you must specify the value of Bounds as a numeric scalar. For a rectangular boundary shape, specify this value as a two-element numeric vector, where the first element represents the length and the second element represents the width.

    Data Types: double

    Names assigned to the boundaries, specified as a string scalar, a vector of strings, or a character vector. Each string must be unique.

    Data Types: string

    Version History

    Introduced in R2026a