How to save a packet (entity in simevents) in matlab workspace?
1 次查看(过去 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.
0 个评论
回答(1 个)
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!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!