stOut = renameStructField(stIn, newNames)
stOut = renameStructField(stIn, oldNames, newNames)
| Parameter | Description |
|---|---|
| stIn | A struct or struct array. |
| newNames | a row vector characters, string array or cell array of strings representing the new field names. When used as the second argument, it must have the same number of elements as the number of fields in stIn. |
| oldNames | a row vector characters, string array or cell array of strings representing the existing field names to rename. Ignored silently if the field name is not present in stIn. |
| Parameter | Description |
|---|---|
| stOut | A struct or struct array. |
renameStructField renames the field names of a struct or struct array.
It supports renaming all field names at once or renaming selected field names individually.
date_st = struct('day', 15, 'month' ,'August','year', 1974)
date_st = renameStructField(date_st, {'Day', 'Month', 'Year'})
date_st = struct('day', 15, 'month' ,'August','year', 1974)
date_st = renameStructField(date_st, 'day', 'jour')
| Version | Description |
|---|---|
| 1.15.0 | initial version |