>> clear = 3

5 views (last 30 days)
Kevin
Kevin on 12 Apr 2016
Commented: Kevin on 12 Apr 2016
Assume that I accidentally type the following command in MATLAB,
>> clear = 3
This will create a variable called "clear" in the base workspace. Now how do I clear this variable?
Assuming that I don't want to close MATLAB and start MATLAB again.

Accepted Answer

Walter Roberson
Walter Roberson on 12 Apr 2016
builtin('clear','clear')
  1 Comment
Kevin
Kevin on 12 Apr 2016
Very nice and clean solution.

Sign in to comment.

More Answers (1)

Steven Lord
Steven Lord on 12 Apr 2016
There are a number of techniques suggested in this posting on Loren's blog.

Categories

Find more on Get Started with MATLAB 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!