selectfields: Select specified field names from a struct

Selects fields listed in a cell array from a struct
94 téléchargements
Mise à jour 13 mars 2019

Afficher la licence

Selects fields listed in a cell array from a struct. Optional third
argument suppresses error message if struct does not contain
given field.
Exmples:
struct2=selectfields(struct1,{list of field names})
Moves field names and corresponding field content from struct1 to
struct2.

struct2=selectfields(struct1,{list of field names},true)
Moves field names and corresponding field content from struct1 to
struct2 if field name exists in struct1. Error messages for
missing field nanes are suppressed

See also renamefields

See doc selectfields

Citation pour cette source

Bill Whiten (2025). selectfields: Select specified field names from a struct (https://fr.mathworks.com/matlabcentral/fileexchange/63774-selectfields-select-specified-field-names-from-a-struct), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2017a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Structures dans Help Center et MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

selectfieldsfldr

Version Publié le Notes de version
2.0.0.0

Updated as suggested by Stephen

1.2.0.0

Reloaded, thanks Stephen

1.1.0.0

Updated to include struct arrays, thanks to Jos & Stephen.
still includes error messages

1.0.0.0