Effacer les filtres
Effacer les filtres

Add zero to make length divisible by 3

1 vue (au cours des 30 derniers jours)
hdiba
hdiba le 6 Août 2016
Commenté : hdiba le 6 Août 2016
Hallo,
i have vector that i want to reshape into a matrix. Therefor i firstly need to prove if the length is divisible by 3. if not i want to add as much zeros at the end of the vector until the length is divisible by 3? can someone help? thanks!

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 6 Août 2016
id=mod(-numel(A),3)
A(end+1:numel(A)+id)=0
  1 commentaire
hdiba
hdiba le 6 Août 2016
Thanks a lot!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by