How can I make vectors within cell array consistent in length?
Show older comments
Please find attached file I want to make the all arrays in same length. I tried the comment below, doesn't work. I really appreciate in advance.
>> N = cellfun(@numel, X);
>> M = max(N);
>> OUT = cellfun(@(a) [a; nan(M - numel(a),1)],X,'uni',0);
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in @(a)[a;nan(M-numel(a),1)]
1 Comment
Farshid Daryabor
on 10 Mar 2020
Answers (0)
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!