How to save a packet (entity in simevents) in matlab workspace?

2 次查看(过去 30 天)
I would like to create a block that receives a flow of packets (simevents entity) and saves all the packets that end up inside it together with the arrival time in the matlab workspace.
Possibly I would like the name of the variable in which the packet flow is saved to be configurable from the block mask in order to facilitate the creation of many of these blocks without going.
I already have a version that uses the ToWorkspace block but it doesn't allow me to easily configure the name of the variable where packages end up, so I was wondering if there is a better solution.

回答(1 个)

Poorna
Poorna 2024-4-21
Hi Simone Bergadano,
I see you have created a block that receives a flow of packets and saves the packets to MATLAB workspace using the "ToWorkspace" block. I get that you want to reuse this block throughout your model to be able to record multiple flows of packets, save them to the workspace and want to easily change the output variable name of the "ToWorkspace" block within your custom block preferably by using a mask dialog variable.
You can use the 'Mask Initialization and Callback code' to achieve your desired behaviour. You can modify the initialization code to change the "VariableName" parameter of the "ToWorkspace" block to the value provided in the mask dialog box. You can use the "set_param" function to achieve this. This initialization code is executed everytime the mask parameters are changed.
Refer to the following documentation to know more about the "Mask Initialization and Callback code":
To know how to use "set_param" function to change block parameters, refer to the following documentation:
Hope this Helps!

类别

Help CenterFile Exchange 中查找有关 Discrete-Event Simulation 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by