MATLAB: How can add a name of table by concatenating strings

indexingtable

I have multiple matlab tables that at first I need load them to the matlab and then do some analysis. Assume they are saved with these names: tableA, tableB, tableC. I am interested to load all in one array by defining the name of tables in one array:
A=['tableA','tableB','tablesC']
so that I can write a for loop to load all arrays instead of writing load for each individual table. Sth like:
for i=1:size(A)
load(A(i))
end
and it wont work because A(i) are strings not the name of tables.
How can I solve this issue?
It is more genreal question. It happens to me in many cases that I need to make the name of table by strcat function.
How can I do that?

Best Answer

Don't do that!
filenames = something appropriate ;
nfiles = length(filenames);
tcell = cell(nfiles, 1);
for k=1:nfiles
filestruct = load(filenames{k});
fn = fieldnames(filestruct);
tcell{k} = filestruct.(fn{1});
end
A = vertcat(tcell{:}) ;