Versione (14,6 KB) da Jan
Rename a fields of a struct - fast C-Mex
2,5K download
Aggiornato 8 giu 2022

Visualizza la licenza

RenameField - Rename a fields of a struct
T = RenameField(S, Old, New)
S: Struct or struct array.
Old, New: CHAR or cell string (M version accept strings), name of the field to be renamed.
T: Struct S with renamed fields.
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.

Cita come

Jan (2024). RenameField (, MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2018b
Compatibile con R2006a e release successive
Compatibilità della piattaforma
Windows macOS Linux
Scopri di più su Structures in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release

M version accepts strings.

Accept cell strings as input.