Insert values into an array

24 vues (au cours des 30 derniers jours)
Joe Abraham
Joe Abraham le 5 Juil 2012
A = [1 3 5 6 7 13]
I want to insert 0 in the 1st cell resulting in
A=[0 1 3 5 6 7 13]
Thanks

Réponse acceptée

Walter Roberson
Walter Roberson le 5 Juil 2012
A = [0 A]; %build new array
Or:
A(2:end+1) = A; %shift over and zero
A(1) = 0;

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by