I know the most inefficient way to do that. (eval)
varNames1 = rand(20,1);
varNames2 = rand(20,1);
varNames3 = rand(20,1);
for i=1:3
C{i} = eval(sprintf('varNames%i',i));
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!