Use eval() or evalin() to get the data from a string representing the variable name. You probably should also include '.csv' in your csv file name. In your example, a is probably a cell array of string, so you should do:
csvwrite([a{1},'.csv'],eval(a{1}))
or
csvwrite([a{1},'.csv'],evalin('base',a{1}))
Considering your previous question, I assume you want to write certain variables in a .mat file to a .csv file, using a GUI for the user to pick and choose the variables. In your call-back function, you can use Vars=load('MyData.mat') to load the data. All the variables will be put in the fields of the structure data Vars. Use VariableNames=fieldnames(Var) to get the list of variable names and use it for your list box. Once you get the chosen variable name in a{1} as shown in your example, Vars.(a{1}) is the data you want to write to your .csv file. Try this at Command line to understand and get familiar with the syntax and then implement it in your code. That way, you can avoid using the eval() function.
Best Answer