I suspect that ScanImage is badly written and saves variables (e.g. structures) with a different name in each .mat file. This matches your example "A1{1,1} = A_1.data; A1{1,2} = A_2.data;", although is a bit unclear in your explanation. In any case, as long as there is only one variable (i.e. structure) per file then this can be resolved by simply ignoring the name of the variable:
D = 'path to the directory where the files are saved';
S = dir(fullfile(D,'A*.mat'));
N = numel(S);
C = cell(1,N);
for k = 1:N
T = load(fullfile(D,S(k).name));
T = struct2cell(T);
C{k} = T{1}.data;
end
Best Answer