StructSearch(input_​struct,search_term)

searches and returns details and child struct with matching parameters.
27 téléchargements
Mise à jour 27 avr. 2018

Afficher la licence

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]

Citation pour cette source

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. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2017b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Structures dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.2.0.0

Forgot to upload updated file:P

1.1.0.0

1. Input arguments error handling

1.0.0.0