Insert values into an array

117 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by