File Exchange

image thumbnail

gcoll: a pedestrian garbage collector and workspace cleaner

version (3.01 KB) by us
garbage-collects workspace variables into a structure and optionally deletes those floating variable


Updated 01 Oct 2003

View License

this little routine is a garbage collector that helps to clean up a messy workspace.

it collects those numerous variables (or selected members of them) either from the base's or caller's workspace into a handy structure, where each fieldname represents a variable with its contents set to the variable's value.

optionally, it will remove the variable after(!) assignment -or- keep only those that are selected.

when called within a function with the option
it collects all current variables used within that function; other options and/or patterns apply.

look at the accompanying image and type
help gcoll
at the command prompt for more insights.

Cite As

us (2021). gcoll: a pedestrian garbage collector and workspace cleaner (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

yasser essiarab

simple but working properly.. I have less out of memory. it should be used with smart preallocation. increase global performance.
a better tutorial might be usefull

Urs Schwarz (us)

please note: there is an update in the pipeline that gets rid of a small typo, adds a new output-formatting style (user request), and updates the thumbnail. it's version_tag is 18-Sep-2003 16:38:20.
min, please remove this pseudo-review after the file got updated.
thanks a bunch in advance, us

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!