필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Simone Bergadano
Simone Bergadano 2024년 4월 16일
편집: Simone Bergadano 2024년 4월 21일
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