renamefields: Rename some field names in a struct

Changes struct field names from cell array list of old names to names in list of new names
100 descargas
Actualizado 18 jul 2017

Ver licencia

Changes struct field names from cell array list of old names to
names in list of new names. Optional fourth argument suppresses
error message if struct does not contain an old name.
Examples
struct2=renamefields(struct1,{list old names},{list new names})
Changes the names given in "list old names" to those given
in "list new names"
struct2=renamefields(struct1,{list old names},{list new names},true)
Changes those names from old names, if present in struct1 to names
from new names
Can also swap names e.g.
struct2=renamefields(struct('a',1,'b',2,'c',3),{'a','b'},{'b','a'})
See also selectfields
See doc renamefields

Citar como

Bill Whiten (2024). renamefields: Rename some field names in a struct (https://www.mathworks.com/matlabcentral/fileexchange/63754-renamefields-rename-some-field-names-in-a-struct), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2017a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Structures en Help Center y MATLAB Answers.
Etiquetas Añadir etiquetas

Community Treasure Hunt

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

Start Hunting!

renamefieldsfldr/

Versión Publicado Notas de la versión
1.0.0.0

Update image
Image update
Add reference to selectfields

Text updated
Update image
Image update
Another image