Borrar filtros
Borrar filtros

Add zero to make length divisible by 3

1 visualización (últimos 30 días)
hdiba
hdiba el 6 de Ag. de 2016
Comentada: hdiba el 6 de Ag. de 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!

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 6 de Ag. de 2016
id=mod(-numel(A),3)
A(end+1:numel(A)+id)=0

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by