MATLAB Answers

Accessing Fields in Structs in Tall Arrays

3 views (last 30 days)
Avinash Rajendra
Avinash Rajendra on 27 Jan 2019
I have a tall cell array whose preview looks like below:
val =
M×1 tall cell array
previewData =
8×1 cell array
{1×1 struct}
{1×1 struct}
{1×1 struct}
{1×1 struct}
{1×1 struct}
{1×1 struct}
{1×1 struct}
{1×1 struct}
: :
: :
Now, I want to be able to access fields inside these structs so I can make calculations. For example, I want to be able to do something like:
if tt.(all structs).correlationId == '.........'
%do something
else
%do something else
end
I also want to be able to group by and partition the array based on the field values of the struct, like:
tt.(all structs).(groupBy and partitionBy).correlationId
Basically, I want to identify a generic struct inside the tall array and proceed from there. Is there any way to do this, either with the tall cell array or the datastore (I'm doing a FileDataStore with a custom read function)?
Or, can I somehow transform the fields of these structs into columns and the values into rows (the structs are identical and this would probably be even better)?
P.S. I'm fairly new to these tall arrays and the nested structures are confusing me a lot, so sorry if I've missed some straightforward solutions.

Answers (0)

Community Treasure Hunt

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

Start Hunting!