StructSearch(input_​struct,search_term)

searches and returns details and child struct with matching parameters.
29.0 次下载
更新时间 2018/4/27

查看许可证

Input:
1.struct (Nested)
2. search string(Case insensitive) to find a member.
Output:
1.Results: [nx4 string] -> [matching_member full_path_of_that_member Class_of_member Description_of_member ]
2.Child_struct= A struct formed with the matching members while preserving the hierarchy.
Application: Useful for nested struct with large number of members. I used it is for MRI data processing.
Eg:
%Example nested struct
P_struct=struct('array_small',[5 6],'array_large',ones(2,3,5),'string', 'Example');
P_struct.N1_strct=struct('string', 'Nested struct 1');
P_struct.N1_strct.N2_struct=struct('string', 'In Nested struct 2');
%Usage
[details, child]=StructSearch(P_struct,'strin');
%output
details =
3×4 string array
"string" "P_struct.string" "char" "Example"
"string" "P_struct.N1_strct.st…" "char" "Nested struct 1"
"string" "P_struct.N1_strct.N2…" "char" "In Nested struct 2"

child =
struct with fields:
string: 'Example'
N1_strct: [1×1 struct]

引用格式

Praveen Iyyappan Valsala (2024). StructSearch(input_struct,search_term) (https://www.mathworks.com/matlabcentral/fileexchange/67096-structsearch-input_struct-search_term), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2017b
兼容任何版本
平台兼容性
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!
版本 已发布 发行说明
1.2.0.0

Forgot to upload updated file:P

1.1.0.0

1. Input arguments error handling

1.0.0.0