I have a variable var0=rand(50,1). I need to write a function that changes the first 5 lines to 0 and the rest to 1.
Ofcourse, I can simply do this like
var0=rand(50,1)
var0(1:5,1)=0
var0(6:end,1)=1
However I need to do this by using one for, one if and one else clause.
I tried many ways but can't get it working with for, it and else.
Can someone please help with this fairly basic fuction?