Undo possible for programmatically changed simulink model?

4 次查看(过去 30 天)
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.

回答(2 个)

Sujit Muduli
Sujit Muduli 2018-3-5
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
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.

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by