Use text in table to make variables
Show older comments
I have a table, T; the first column contains text enclosed in single quotes, and the second column contains scalar numbers:
Symbol Value
1 'Z1' 3
2 'Z2' 4
How can I get Matlab to create variables from the Symbols and assign the Values to them? ie
Z1=3
Z2=4
I could convert T.Symbol into a string vector:
T.Symbol =s,
but how can I convert s into variables, without having to type each variable manually? (In reality, my table contains many rows, and I have more than one table.)
Accepted Answer
More Answers (1)
dpb
on 22 Jan 2021
0 votes
Do NOT even think about doing this.
1 Comment
David Slater
on 23 Jan 2021
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!