MATLAB Answers

extracting data from struct(structure within a structure)

5 views (last 30 days)
Charms on 21 Aug 2019
Commented: Charms on 21 Aug 2019
I have a struct dataset (trials), with 1x1 struct data set in them. The 1x1 struct data sets (under target) contain 3 fields (timestamp, row & column), and I need to shortlist them by row & column (both), into a new matrix. I tried inputing A = [(trials(1).target,'row')] but was returned with "expected one output from a curly brace or dot indexing expression, but there were 100 results"
That is my intention, to have those 100 results expressed in a new vector like so
A = 4
May I know how do I correct this? Thank youu


Sign in to comment.

Accepted Answer

Matt J
Matt J on 21 Aug 2019
Edited: Matt J on 21 Aug 2019
This may be what you want,
but it is not very clear from your post how the struct is organized. Best is to attach it in a .mat file so that forum readers can study it.


Matt J
Matt J on 21 Aug 2019
Yes, I can see it, but as far as I can tell the code I posted works fine. Did you try it?

Sign in to comment.

More Answers (0)

Translated by