- Avoid saving in closeFcn: Instead, try saving your model before closing it, such as in a custom button, script, or using the PreCloseFcn callback if available.
- Manual Save: Save changes manually before closing, or use autosave features. Kindly go through https://www.mathworks.com/help/simulink/slref/save_system.html to know more.
- Alternative Callbacks: Consider using other callbacks like PreSaveFcn or PostSaveFcn for custom actions related to saving. Kindly go through https://www.mathworks.com/help/simulink/ug/model-callbacks.html to know more.
why state flow getting corrupted?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ajay krishna Vasanthakumar
el 4 de Sept. de 2020
Respondida: Akanksha
el 29 de Ag. de 2025 a las 8:22
when i save the model containing stateflow chart using save_system(gcs) in closeFcn,the chart is getting corrupted.
can someone explain why it is happening?
Thanks
0 comentarios
Respuestas (1)
Akanksha
el 29 de Ag. de 2025 a las 8:22
Saving a Simulink model programmatically inside the closeFcn callback (like using save_system(gcs)) can cause issues because the model is already in the process of closing, and certain resources or states may not be available or stable at that moment. This can lead to model corruption, especially for complex blocks like Stateflow charts.
Here are the alternate solutions that you can try:
Below are some helpful official links where you can find more information:
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Decision Logic en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!