Indexing into a structure to retain/remove elements based on a string
Show older comments
I have a variable containing a string for one eye (i.e. selectedEye = LEFT) and a struct called "x" with 2 fields:
x =
eye: {1x1938 cell}
timestamp: [1x1938 double]
Each cell in the field "eye" contains the string "LEFT" or "RIGHT". What code would I use to retain cells and corresponding timestamps for just the left eye (i.e. deleting eye/timestamp entries for one eye)?
I tried the following to try to obtain a logical:
x.eye = x.eye(regexp(cellstr(selectedEye),x.eye))
...but received an error ("Function 'subsindex' is not defined for values of class 'cell'.")
Accepted Answer
More Answers (0)
Categories
Find more on Search Path in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!