Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Create Struct using variable values?

Status
Not open for further replies.

TimJrSSTi

Computer
Mar 23, 2009
2
0
0
US
Is there a way to create a struct using the value of a variable?

For example say I had the following variables:

league='MLB'
team='Phillies'

How can I create a struct that looks like the following using the variables league & team:

MLB.Phillies.player1='Utley'

Is it even possible?
 
Replies continue below

Recommended for you

Anything is possible if you cross over into the dark side and use "eval". Don't expect your code to be readable though. Do expect your workspace to become flooded with variables.

- Steve
 
Status
Not open for further replies.
Back
Top