Accessing variable in struct using string

Hello,
I am trying to access a variable within a struct named
behaviours{1,1}.pedestrian1
Is it possible to access this variable if I have a string named "pedestrian1" ? Basically something like this
ped = 'pedestrian1'
display(behaviours{1,1}.ped)

 Accepted Answer

Adam
Adam on 7 Dec 2018
Edited: Adam on 7 Dec 2018
behaviours{1,1}.( ped )
should work

More Answers (0)

Categories

Tags

Asked:

on 7 Dec 2018

Edited:

on 7 Dec 2018

Community Treasure Hunt

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

Start Hunting!