MATLAB: How to create this vector [ 10 9 10 9 …] with one command

homeworkvectors one command

hi can you help us to create this vector with one command v=[10 9 10 9 …] 100 times with one command only
and how to create this vector =[ 1 1 2 2 3 3 4 4] with only one command !!
also how to create this with only one command =[ 1 1 2 2 1 1 2 2]
and finally this vector =[ -1 1 -2 2 -3 3 -4 4]
thank you guys 🙂 !!

Best Answer

hi, try :
v=repmat([10 9]',[50 1]);