View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
cch - close, clear, home

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0
5.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 1.83 KB File ID: #43264 Version: 1.22

cch - close, clear, home

by

 

29 Aug 2013 (Updated )

CCH saves keystrokes in resetting MATLAB by running the commands close, clear, and home.

| Watch this File

File Information
Description

CCH accepts arguments to be passed to the CLEAR command. If one of the arguments is '-BREAKS', breakpoints will not be cleared.
By default (modifiable), CCH by itself with no arguments is the same as CCH -BREAKS.
Over the years, I've used a micro-script version of this on the order of dozens or even hundreds of times in a typical day of using MATLAB. It's also the first line of many of my utility scripts and shortcuts.
There are two similar submissions on the file exchange, but both use "clc" instead of "home", which in my experience sometimes results in throwing away useful command window history information when you wish you hadn't. I'm therefore a proponent using "home" over "clc" — perhaps I can convert some users with this submission.

Acknowledgements

Clr == Clear All; Close All; Clc;, Ccc, and Clear Most inspired this file.

MATLAB release MATLAB 8.1 (R2013a)
MATLAB Search Path
/
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
24 Feb 2016 Jan Simon

Jan Simon (view profile)

The debugger breakpoints are restored after clearing. And the function does not necessarily clear "all". Therefore I must be honest and rate it according to my earlier comment.

The code is clearly written and well documented. It is useful and usable.

07 Sep 2013 Jan Simon

Jan Simon (view profile)

As usual I warn that "clear all" removes all loaded M-files from the memory and reloading is expensive. But removing all breakpoints is worse, because it impedes a debugging. See Stefan's comment (23 Jul 2013) in http://www.mathworks.com/matlabcentral/fileexchange/42559-ccc for a method to restore the break points.

As before for similar functions, I do not rate, because in my opinion this earns 1 star (due to the "clear all") or 5 stars (because it might reduce the "clear all" inside other functions).

Comment only
Updates
09 Sep 2013 1.1

breakpoint preservation; passing args to clear command

09 Sep 2013 1.2

breakpoint preservation; passing args to clear command

15 Feb 2016 1.21

'all' argument no longer default for the sake of speed.

23 Feb 2016 1.22

Simplified fclose.

Contact us