addNodes
Description
addNodes(
adds wireless nodes to the wireless traffic viewer object,
wirelessTrafficVis,node)wirelessTrafficVis.
Examples
Initialize a wireless network simulator, then create and configure both an access point (AP) node and a station (STA) node. After associating the STA with the AP, you add both nodes to the simulation. Next, you set up a wireless traffic viewer for visualization and run the simulation to observe the state transitions and channel occupancy of the wireless nodes.
Initialize the wireless network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Create and configure the AP node.
deviceCfg = wlanDeviceConfig(Mode="AP"); apNode = wlanNode(Name="AP",Position=[0 10 0],DeviceConfig=deviceCfg);
Create the STA node with a default device configuration.
staNode = wlanNode(Name="STA",Position=[5 0 0]);Associate the STA node with the AP node.
associateStations(apNode,staNode,FullBufferTraffic="on")Add the nodes to the simulator.
addNodes(networkSimulator,[apNode staNode])
Create a wireless traffic viewer and add the nodes to it.
wirelessTrafficVis = wirelessTrafficViewer; addNodes(wirelessTrafficVis,[apNode staNode])
Set the simulation time, and run the simulation.
simulationTime = 0.2; run(networkSimulator,simulationTime)

Try exploring these additional features of the wireless traffic viewer:
Disable and enable nodes from plots.
Disable and enable operating states and node types.
Visualize certain time and frequency durations.
Export images.
Simulate a Bluetooth® Low Energy (LE) network to observe the state transitions and channel occupancy of Bluetooth nodes. Initialize the wireless network simulator, create and connect a Central and a Peripheral node, and configure On-Off traffic. After adding the nodes to the simulator and the wireless traffic viewer, run the simulation and visualize node activity.
Initialize the wireless network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Set simulation time.
simulationTime = 0.2;
Create a Central and PeripheralBluetooth LE node.
centralNode = bluetoothLENode("central",Position=[0 0 0]); peripheralNode = bluetoothLENode("peripheral",Position=[1 0 0]);
Create and configure the connection between the nodes.
cfg = bluetoothLEConnectionConfig; configureConnection(cfg,centralNode,peripheralNode);
Configure On-Off traffic.
traffic = networkTrafficOnOff(DataRate=200,PacketSize=27,OnTime=Inf,OffTime=0);
Add traffic sources.
addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode)
Add the nodes to the simulator.
nodes = [centralNode peripheralNode]; addNodes(networkSimulator,nodes)
Create a wireless traffic viewer and add the nodes to it.
wirelessTrafficVis = wirelessTrafficViewer; addNodes(wirelessTrafficVis,nodes)
Run the simulation.
run(networkSimulator,simulationTime)

Try exploring these additional features of the wireless traffic viewer:
Disable and enable nodes from plots.
Disable and enable operating states and node types.
Visualize certain time and frequency durations.
Export images.
Input Arguments
Wireless traffic viewer, specified as a wirelessTrafficViewer
object.
Wireless node, specified as an object of a subclass of wnet.Node, a
vector of objects of subclass of wnet.Node, or a cell array of objects of
subclass of wnet.Node.
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)