5.0

5.0 | 4 ratings Rate this file 25 downloads (last 30 days) File Size: 1.14 KB File ID: #4259

KEEP3

by Martin Barugel

 

15 Dec 2003 (Updated 12 Jan 2004)

No BSD License  

Keeps the specified variables and clears the rest. Allows the use of the wildcard *...

Download Now | Watch this File

File Information
Description

This is another modified version of the original KEEP M-file by Xiaoning (David) Yang (1998). It allows the user to specify some variables and clear the rest, and uses the same syntax as the clear command. The main contribution of this code is that it allows the use of the wildcard * in exactly the same fashion as the clear command.

keep3 var1 var2
Clears all variables expect var1 and var2

keep3 va*2
Clears all variables expect those whose names begin with 'va' and end with '2'.

Requires Matlab 6.5 (R13) because it makes use of the regexp command.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
keep
This submission has inspired the following:
Keep4

MATLAB release MATLAB 6.5 (R13)
Other requirements Matlab 6.5 (uses regexp)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
05 Jun 2004 J Fav

very useful - just what I needed!

11 Aug 2005 yangcan gong

great!

31 Dec 2007 Carsten S

Excellent function!

28 Mar 2008 Mark Thommy

A very useful script which builds on the ability of "keep". Has helped me a lot. Thanks to the author!

Please login to add a comment or rating.
Updates
12 Jan 2004

Fixed a bug that caused KEEP3 to clear all variables when there where no variables to clear. It now works just fine.

Tag Activity for this File
Tag Applied By Date/Time
keep Martin Barugel 22 Oct 2008 07:11:05
clear Martin Barugel 22 Oct 2008 07:11:05
variable Martin Barugel 22 Oct 2008 07:11:05
wildcard Martin Barugel 22 Oct 2008 07:11:05
utilities Martin Barugel 22 Oct 2008 07:11:05
miscellaneous Martin Barugel 22 Oct 2008 07:11:05
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com