getnestedfield

version 1.1.0.0 (2.91 KB) by Bob Spunt
Find a (potentially nested) field in a structure and return its contents

99 Downloads

Updated 17 Aug 2015

From GitHub

View License on GitHub

Use a regular expression to find a (potentially nested) field in a structure and return its contents.
USAGE: F = getnestedfield(S, EXP)
INPUTS
S: The struct to search
EXP: Pattern used to find field (passed to REGEXP)

OUTPUT
F: Field contents. If no fields are found, is an empty array. If multiple fields found, is a N x 2 cell array where N is the number of matching fields, first column contains full locations of each match, and second column contains their values (this is raw output from NSTRUCT2CELL, see CREDIT below).

Cite As

Bob Spunt (2022). getnestedfield (https://github.com/spunt/getnestedfield), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: NSTRUCT2CELL

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.