File Exchange

image thumbnail

clearempty

version 1.1 (7.02 KB) by

clear all empty variables from current workspace

0 Downloads

Updated

View License

Simply type "clearempty" to clear all empty variables from the workspace.

Comments and Ratings (2)

Chad Greene

Chad Greene (view profile)

Thanks Jan. I knew there must be a way to do it looplessly. I've implemented the changes you suggested.

Jan Simon

Jan Simon (view profile)

If WHOS is used instead of WHO, you can avoid the first evil EVAL. The 2nd one is not required also:
clear(clearEmptyList{clearEmptyk});

Another EVAL and loop-free approach:

whosList_ = whos;
nameList_ = {whosList_([whosList_.bytes]==0).name};
clear(nameList_{:}, 'whosList_', 'nameList_');

Updates

1.1

Removed loops and evals.

MATLAB Release
MATLAB 8.0 (R2012b)
Acknowledgements

Inspired by: ccc

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

» Watch video

clearempty_demo/html/