how to add zeros to the beginning and end

15 visualizaciones (últimos 30 días)
grandong oblong
grandong oblong el 3 de Mzo. de 2020
Comentada: grandong oblong el 3 de Mzo. de 2020
how to add zeros to the beginning and end
a = [1 3 5];
%result
a = [0 0 1 3 5 0 0];

Respuestas (1)

James Tursa
James Tursa el 3 de Mzo. de 2020
Lots of ways to do this. Depends on how many zeros you want. E.g.,
a = [0 0 a 0 0];
Or,
m = 2;
n = 2;
a = [zeros(1,m) a zeros(1,n)];

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by