Olympic puzzle number one
조회 수: 2 (최근 30일)
이전 댓글 표시
clear = @()disp('Have fun undoing this (:');
Let's solve this challenge and restore the original clear command in as many ways as you find.
댓글 수: 3
채택된 답변
추가 답변 (4개)
Mike Hosea
2012년 7월 31일
편집: Mike Hosea
2012년 7월 31일
- builtin('clear','clear')
- You can delete the variable from the workspace window (highlight and press delete or right click and delete).
I look forward to reading some more creative ways.
댓글 수: 2
Daniel Shub
2012년 8월 1일
I wonder if the workspace window method method can be accessed by a java method from the commandline.
Daniel Shub
2012년 7월 31일
Missing from the obvious solutions are:
clear = str2func('clear'); clear();
and
feval('clear');
댓글 수: 3
Mike Hosea
2012년 8월 1일
If you wanted to leave the rest of the workspace undisturbed it would have been four mentions of "clear":
clear = str2func('clear'); clear('clear');
Daniel Shub
2012년 7월 31일
Somewhat surprisingly the CLEARVARS function is not a solution and gives an unhelpful error message. I think the failure probably qualifies as a bug.
댓글 수: 3
Daniel Shub
2012년 8월 1일
@Sean, my point was that it could be a slightly fancy wrapper that could catch this error
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!