You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
ML provides a useful function RMFIELD to remove specified field(s) from a structure, but no corresponding function to KEEP specified field(s), removing the rest. This function addresses that discrepancy.
ex.:
a = dir('*.m');
b = keepfield(a,{'name','date'});
This is an exceptionally short but useful piece of code.
Cite As
Brett Shoelson (2026). keepfield (https://se.mathworks.com/matlabcentral/fileexchange/7031-keepfield), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired by: keep
General Information
- Version 1.0.0.0 (1.4 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 |
