MATLAB: Extract elements from a cell array

cellcell arraysMATLABmatrixmatrix manipulationStatistics and Machine Learning Toolbox

Hello,
Please help me with the following:
Consider a 3×1 cell array where its cells contain matrices as shown below:
C{1,1}= 206×89
C{2,1}= 78×89
C{3,1}= 108×89
How can I extract the first 20 elements of each matrix and stored them in a new cell?
The final matrices will be
206×20
78×20
108×20
Thank you very much.
Pavlos

Best Answer

out = cellfun(@(x)x(:,1:20),C,'un',0);