How to make cell array same length after padding zeros
问题 This is data matrix having 2*159 cells In the data matrix so many columns ( 2 vectors) having different length . I want to pad zeros which have the minimum length. Number of zeros should be [max(length(Vector 1))-min(length(Vector 2))] Now I want add zeros in the cell which have minimum length. and want to make length equal in each column if column have same length than no problem. 回答1: n = max(max(cellfun(@(x)size(x,2),data))) cellfun(@(x)[x, zeros(1,n-numel(x))], data, 'uni', 0) The above