MATLAB: Create a new variable whos name is conditional

create a new variableMATLAB

Hi. How can I creat a new variable whose name I dont know yet. A simple example is below. Thanks
>> [a,b,c]=xlsread('myfile.xlsx')
a =
[]
b =
'new_var'
c =
'new_var'
.... now I want to create a variable whose name is the same as the string taken from b . i.e I want to creat a variable with name new_var . and then give it a value ( new_var=10). How?

Best Answer

Use the genvarname command.
mv = genvarname('my_varname');
eval([mv '= 123;']);
my_varname