Argument to dynamic structure reference must evaluate to a valid field name.

Answers (1)

You can avoid this error by changing this line (line 164):
s(2).subs = {requestedStats{p}};
to this:
s(2).subs = requestedStats{p};
However, you can avoid using subsref/subsasgn (and constructing the necessary substruct) entirely by changing line 172 to:
outstats(k).(requestedStats{p}) = stats(k).(requestedStats{p});

Categories

Tags

Asked:

on 20 Mar 2022

Answered:

on 20 Mar 2022

Community Treasure Hunt

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

Start Hunting!