View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
StructFind

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.0
4.0 | 1 rating Rate this file 8 Downloads (last 30 days) File Size: 1.76 KB File ID: #35022 Version: 1.0

StructFind

by

 

Find all fields within a struct (array) where the search pattern is found

| Watch this File

File Information
Description

Function to search for entries within a structure. This is done recursively, running through all elements of array-structures.

Input:

      search_struct: structure to be searched, could also be array of struct

      search_object: string, integer, cell, array or other thing to be searched for

   [optional]

      structure_name: name of the structure to be searched. Used for full output of the structure content

Output:

      FoundFields: Cell array of fields where the search object is found.

Acknowledgements

Structfind inspired this file.

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
29 Feb 2016 Alexander Mering

Hello Brain, thanks for the feedback.

The problem is, that using regexpi would limit the search to purely string structures. So a plain replacement would be inadequat.

Nevertheless, this might be an option for further extension using search type discrimination or so.

Alexander

Comment only
26 Feb 2016 Brian

Brian (view profile)

This was extremely helpful.

I modified the comparison from isequal to regexpi so I can find names with part of the string in. If you update this file, maybe add that as an option?

Contact us