MATLAB: How to equalize the size of all arrays in a cell array

cell arrayscell funcellsdata manipulationecgmatrixsignal processing

This is my cell array:
Q_Vic1 =
[29x1 double] [28x1 double] [28x1 double] [28x1 double] [28x1 double] [28x1 double] [28x1 double] [28x1 double] [28x1 double] [28x1 double] [29x1 double]
I need to equalize all arrays to size of [29×1]-max array size.
I tried this code(found from Matlab Answers,the one suggested by Laura Proctor ):
I get same length but different size!:
Q_Vic1 =
[29x1 double] [1x29 double] [1x29 double] [1x29 double] [1x29 double] [1x29 double] [1x29 double] [1x29 double] [1x29 double] [1x29 double] [29x1 double]
I tried the same kind of code with size and cellfun and its still not working.I know in order to convert the cell to matrix the arrays must be of same size. Any suggestions?I would really appreciate general purpose codes,rather than taking transpose of the specific arrays:I would be using the same code for different signals(inputs). Ultimately,I need to store all the arrays in different matrices(arrays,not in cell) and process these signals further. It is difficult to access them(the array) when they are in a cell. If there is an alternate method of storing the arrays in individual normal arrays,I would welcome that too.

Best Answer

You want to pad the shorter arrays with zeros?
Q_Vic1 = {[1 2 3], [1 2], [1 2 3 4]}
ML = max(cellfun(@numel, Q_Vic1))
Q_Vic1_out = cellfun(@(x) [x zeros(1, ML - numel(x))], Q_Vic1, 'un', 0)