RenameField

Version 1.2.0.0 (14,6 ko) par Jan
Rename a fields of a struct - fast C-Mex
2,5K téléchargements
Mise à jour 8 juin 2022

Afficher la licence

RenameField - Rename a fields of a struct
T = RenameField(S, Old, New)
INPUT:
S: Struct or struct array.
Old, New: CHAR or cell string (M version accept strings), name of the field to be renamed.
OUTPUT:
T: Struct S with renamed fields.
EXAMPLES:
S.A = 1; S.B = 2;
T = RenameField(S, 'B', 'C'); % T.A = 1, T.C = 2
This function was created after a discussion in Loren's blog:
Tested: Matlab 2009a/2015b/2018b, Win10, LCC3.8, BCC5.5, OpemWatcom 1.8, MSVC 2008
Compatibility to 64 bit, Linux, MacOS is assumed.
Look in the C-file for instructions to compile the Mex file at first.
A slower M-version is included.

Citation pour cette source

Jan (2024). RenameField (https://www.mathworks.com/matlabcentral/fileexchange/28516-renamefield), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2018b
Compatible avec les versions R2006a et ultérieures
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!
Version Publié le Notes de version
1.2.0.0

M version accepts strings.

1.1.0.0

Accept cell strings as input.

1.0.0.0