File Exchange

image thumbnail

keepfield

version 1.0 (1.4 KB) by

Keep specified fields of a structure, discarding other fields.

0 Downloads

Updated

View License

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.

Comments and Ratings (1)

Omer Demirkaya

Saved my time! This is exactly what I needed.

MATLAB Release
MATLAB 7.0.1 (R14SP1)
Acknowledgements

Inspired by: keep

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

» Watch video

Win prizes and improve your MATLAB skills

Play today