Effacer les filtres
Effacer les filtres

How to fill cell arrays with zeros to make them equal

4 vues (au cours des 30 derniers jours)
Joseph Lee
Joseph Lee le 10 Déc 2017
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}

Réponse acceptée

Matt J
Matt J le 10 Déc 2017
for i=1:numel(M)
M{i}(end,108)=0;
end
  1 commentaire
Walter Roberson
Walter Roberson le 10 Déc 2017
Modifié(e) : Walter Roberson le 10 Déc 2017
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by