Undo possible for programmatically changed simulink model?

4 visualizaciones (últimos 30 días)
Raphael Klapczynski
Raphael Klapczynski el 21 de Feb. de 2018
Respondida: Raphael Klapczynski el 5 de Mzo. de 2018
I've created some little helper-functions which help me e.g. to automatically create in- and outports for Subsystems or automatically reposition those ports. I'm using the add_block, add_line, set_param functions for this.
Is there any way to be able to undo those changes in Simulink if necessary?
Thanks in advance.

Respuestas (2)

Sujit Muduli
Sujit Muduli el 5 de Mzo. de 2018
Hi Raphael,
There is no API call available to do the UNDO operation.
But you may implement your custom UNDO function by keeping the handles for each of the blocks and lines that you are creating by your scripts.
Just wondering about your use case and where you are thinking of using this UNDO call could you please let me know about your workflow?

Raphael Klapczynski
Raphael Klapczynski el 5 de Mzo. de 2018
Hi Sujit, I use simple functions to e.g. automatically generate necessary inport and outport blocks for the selected Subsystem, reposition/reorder the child blocks of the selected Subsystem (to tidy up the model), etc...
There is always the possibility that you're doing something wrong and want to UNDO it. If I would implement a custom UNDO function it should work the same (usability)(same Buttons, same Hotkey-Buttons) as the original UNDO function which I don't know how to implement without collide with the original UNDO function (e.g. start an UNDO-step for my script without activating the original UNDO-function and vice versa). There needs to be an "observer" which decides if the next UNDO step is from my function or from the Simulink-UNDO. Don't know if that is possible.
Thanks in advance for your help.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by