From: Roses Jonse on
Hello,
I working on a project that required undo/redo action I find a suitable code for undo that
help me and I try my best to edit this code so I can use it for redo but I couldn't can some one help me please.
hint:I didn't have GUI in my project but I have my own interface so I couldn't use uiundo function built in Matlab.

the code of undo:
function Undo(n)

if nargin==0
n=1;
end
if ischar(n)
n = sscanf(n,'%i');
end

if n<1
error (['Not undoing ' int2str(n) ' items']);
end
g=get(gca,'children');
%L=length(g);
for i=1:n
delete(g(i));
end

end