Structure cat, merge and override

版本 1.0.0.0 (3.4 KB) 作者: Johan Winges
Utility functions for structures in Matlab to cat (concatenate), merge and override structures.
125.0 次下载
更新时间 2015/8/17

Utility functions for structures in Matlab. Contains functions to cat (concatenate), merge and override structures.
(1) cat_struct:
Syntax:
C = cat_struct(dim, A, B)
C = cat_struct(dim, A1, A2, A3, A4, ...)
Description:
Allows for concatenation of array structures with different fieldnames by introducing the missing fieldnames and setting their values empty. Internally calls the function cat after missing fieldnames have been supplied with empty value fields.

(2) merge_struct:
Syntax:
A = merge_struct(A, B)
A = merge_struct(A1, A2, A3, A4, ...)
Description:
Merges scalar structures into a single structure containing all fieldnames of the supplied structures. The last instance of any fieldname will set the final value of this fieldname.

(3) override_struct:
Syntax:
A = override_struct(A, B)
A = override_struct(A, B1, B2, B3, B4, ...)
A = override_struct(A, Name, Value, ...)
Description:
Overrides fieldnames in the structure A with the values of the same fieldname in structure B. Fieldnames in B that do not exists in A are ignored. Fieldnames to be overridden can also be supplied as Name/Value pairs, which makes this function a lightweight alternative to the excellent inputParser object for simple input parsing without any explicit error control.

引用格式

Johan Winges (2024). Structure cat, merge and override (https://github.com/johwing/matlab_structure_utility), GitHub. 检索来源 .

MATLAB 版本兼容性
创建方式 R2014b
兼容任何版本
平台兼容性
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!

无法下载基于 GitHub 默认分支的版本

版本 已发布 发行说明
1.0.0.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库