ho to implement Undo/Redo in a Matlab App
Show older comments
I am after a good snippet code that would allow to have some Undo/Redo function.
I have found this intersiting one: uiundo - Matlab's undocumented undo/redo manager - Undocumented Matlab But it seems that uiundo might be removed at some point. I am happy to keep exploring this method, but I would like to find something more general in term of time history.
How to capture previous actions/values from the gui? Should I implement something like having a private property:
app.Data
app.DataBackwardStep
app.DataForwardStep
on new action:
- DataBackwardStep(end+1) = app.Data
on undo:
- app.DataForwardStep = app.Data
- app.Data = app.DataBackwardStep(end-1)
- app.DataBackwardStep(end) = [ ]
on redo
- app.Data = app.DataForwardStep
- DataBackwardStep(end+1) = app.Data
happy to see what others have already implemented
Accepted Answer
More Answers (0)
Categories
Find more on Just for fun in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!