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.
引用格式
Brett Shoelson (2026). keepfield (https://ww2.mathworks.cn/matlabcentral/fileexchange/7031-keepfield), MATLAB Central File Exchange. 检索时间: .
致谢
参考作品: keep
| 版本 | 已发布 | 发行说明 | Action |
|---|---|---|---|
| 1.0.0.0 |
