How can I make multiple cell array sizes the same
2 次查看(过去 30 天)
显示 更早的评论
I'm working with a cell array,time which has 1by4 cell. i.e time= 1 by 4 cell arrays. Each cell has differnt sizes. i.e
time{1,1}=2800 by 1
time{1,2}=1800 by 1
time{1,3}= 3099 by 1
time{1,4}= 2872 by 1
How can I make all time {1,i} size the same. i.e
time{1,i}= 3099 by 1
2 个评论
采纳的回答
madhan ravi
2019-2-9
A=max(cellfun(@length,time));
Result=cellfun(@(x) [x;zeros(A-numel(x),1)] ,time ,'un',0)
4 个评论
madhan ravi
2019-2-15
A=max(cellfun(@(x)size(x,2),b));
Result=cellfun(@(x) [x zeros(size(x,1),A-size(x,2),1)] ,b ,'un',0)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!