Olympic puzzle number one
古いコメントを表示
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 件のコメント
John Petersen
2012 年 7 月 31 日
編集済み: John Petersen
2012 年 7 月 31 日
Would somebody please answer this so I can use clear again? aaaah... Thanks Mike!!
Daniel Shub
2012 年 7 月 31 日
Jan
2012 年 7 月 31 日
採用された回答
その他の回答 (4 件)
Mike Hosea
2012 年 7 月 31 日
編集済み: Mike Hosea
2012 年 7 月 31 日
3 投票
- 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.
Sean de Wolski
2012 年 7 月 31 日
clear = rand(1000,500,700);
pack
Daniel Shub
2012 年 7 月 31 日
Missing from the obvious solutions are:
clear = str2func('clear'); clear();
and
feval('clear');
3 件のコメント
Sean de Wolski
2012 年 7 月 31 日
編集済み: Sean de Wolski
2012 年 7 月 31 日
Nice! I would've thought the str2func solution would have recursively called itself.
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 日
1 投票
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 件のコメント
Sean de Wolski
2012 年 7 月 31 日
clearvars is just a fancy wrapper for evalin with clear.
edit clearvars
Jan
2012 年 7 月 31 日
Daniel Shub
2012 年 8 月 1 日
@Sean, my point was that it could be a slightly fancy wrapper that could catch this error
カテゴリ
ヘルプ センター および File Exchange で Board games についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!