MATLAB: How to create this vector: [10,8,10,8,10, …]

How can I create a vector that alternates 10 and 8 100 times?

Best Answer

Hi
a=zeros(1,100);
a(1:2:99)=10;
a(2:2:100)=8;