MATLAB: How to concatenate cells in mat file under each other

cell arrays

Hello, I have a .mat file which is comprised of 255 cells. Each cell is a 14 by 65 table. I need to concatenate the tables under each other so that I can have a 14*225 by 65 table at the end. Does anyone know how I can do so in Matlab?

Best Answer

Your question is unclear: does the mat file contain one cell array of 255 elements, or 255 separate scalar cell arrays?
If there are 255 separate scalar cell arrays and no other data in the file:
D = 'absolute/relative path to where the file is saved';
F = 'the filename.mat';
S = load(fullfile(D,F));
C = structcell(S);
T = vertcat(C{:});
If there is only one cell array of 255 elements and no other data in the file, replace struct2cell with:
C = S.nameOfTheField;
Related Question