Save/Load Simulink Code-Generated State
Is it possible to save/serialize the internal state structs of a Simulink code-generated model, and re-load those on a later initialization?
To prevent X/Y problem, I am using a GRT code-generated Simulink model to simulate a specific plant. My controls are neccessarily but unfortunately outside of Matlab/Simulink. I would like to modify parameters in a control scheme and assess their performance over a specific region of the simulation. Essentially like in a video game, you may fail some challenge and you are restarted at some checkpoint.
I have tried using a reusable function, and then use the tool ‘cser’ to serialize the main model struct, however it quickly gets confused with the vast number of types pointing to other types. Additionally, some of the structs contain pointers, so I can’t simply write the memory of the struct to a file.Is it possible to save/serialize the internal state structs of a Simulink code-generated model, and re-load those on a later initialization?
To prevent X/Y problem, I am using a GRT code-generated Simulink model to simulate a specific plant. My controls are neccessarily but unfortunately outside of Matlab/Simulink. I would like to modify parameters in a control scheme and assess their performance over a specific region of the simulation. Essentially like in a video game, you may fail some challenge and you are restarted at some checkpoint.
I have tried using a reusable function, and then use the tool ‘cser’ to serialize the main model struct, however it quickly gets confused with the vast number of types pointing to other types. Additionally, some of the structs contain pointers, so I can’t simply write the memory of the struct to a file. Is it possible to save/serialize the internal state structs of a Simulink code-generated model, and re-load those on a later initialization?
To prevent X/Y problem, I am using a GRT code-generated Simulink model to simulate a specific plant. My controls are neccessarily but unfortunately outside of Matlab/Simulink. I would like to modify parameters in a control scheme and assess their performance over a specific region of the simulation. Essentially like in a video game, you may fail some challenge and you are restarted at some checkpoint.
I have tried using a reusable function, and then use the tool ‘cser’ to serialize the main model struct, however it quickly gets confused with the vast number of types pointing to other types. Additionally, some of the structs contain pointers, so I can’t simply write the memory of the struct to a file. code generation, simulink, simulation, serialization MATLAB Answers — New Questions