renamefields: Rename some field names in a struct

版本 1.0.0.0 (4.4 KB) 作者: Bill Whiten
Changes struct field names from cell array list of old names to names in list of new names
100.0 次下载
更新时间 2017/7/18

查看许可证

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

引用格式

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. 检索来源 .

MATLAB 版本兼容性
创建方式 R2017a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Structures 的更多信息
标签 添加标签

Community Treasure Hunt

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

Start Hunting!

renamefieldsfldr/

版本 已发布 发行说明
1.0.0.0

Update image
Image update
Add reference to selectfields

Text updated
Update image
Image update
Another image