selectfields: Select specified field names from a struct

版本 2.0.0.0 (4.4 KB) 作者: Bill Whiten
Selects fields listed in a cell array from a struct
94.0 次下载
更新时间 2019/3/13

查看许可证

Selects fields listed in a cell array from a struct. Optional third
argument suppresses error message if struct does not contain
given field.
Exmples:
struct2=selectfields(struct1,{list of field names})
Moves field names and corresponding field content from struct1 to
struct2.

struct2=selectfields(struct1,{list of field names},true)
Moves field names and corresponding field content from struct1 to
struct2 if field name exists in struct1. Error messages for
missing field nanes are suppressed

See also renamefields

See doc selectfields

引用格式

Bill Whiten (2024). selectfields: Select specified field names from a struct (https://www.mathworks.com/matlabcentral/fileexchange/63774-selectfields-select-specified-field-names-from-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!

selectfieldsfldr

版本 已发布 发行说明
2.0.0.0

Updated as suggested by Stephen

1.2.0.0

Reloaded, thanks Stephen

1.1.0.0

Updated to include struct arrays, thanks to Jos & Stephen.
still includes error messages

1.0.0.0