How to fill cell arrays with zeros to make them equal

1 次查看(过去 30 天)
M=
{10x107}
{10x108}
{10x103}
{10x105}
how to fill each cell with zeros to reach the size of the max length cell
Gives
M=
{10x108}
{10x108}
{10x108}
{10x108}

采纳的回答

Matt J
Matt J 2017-12-10
for i=1:numel(M)
M{i}(end,108)=0;
end
  1 个评论
Walter Roberson
Walter Roberson 2017-12-10
编辑:Walter Roberson 2017-12-10
That will write 0 at M{2}(10,108) but that should not be changed.
for i=1:numel(M)
if size(M{i},2) < 108
M{i}(end,108)=0;
end
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by