keepfield

Keep specified fields of a structure, discarding other fields.

Vous suivez désormais cette soumission

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.

Citation pour cette source

Brett Shoelson (2026). keepfield (https://fr.mathworks.com/matlabcentral/fileexchange/7031-keepfield), MATLAB Central File Exchange. Extrait(e) le .

Remerciements

Inspiré par : keep

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0