keepfield

Keep specified fields of a structure, discarding other fields.

您现在正在关注此提交

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

类别

Help CenterMATLAB Answers 中查找有关 Structures 的更多信息

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.0.0.0