I want a column vector of random 5 and 1s (roughly equal number of each). I can easily get a column vector of full of 5 and 0s by doing this:
rc = 5*(rand(400,1)<0.5)
I believe this is a MatLab style way of doing things. However, I want to avoid having to do this:
for y = 1 : length(rc)
if rc(i) == 0
rc(i) = 1;
end
end
because 1) I have to iterate all over again 2) it’s not ‘MatLab like’. Any ideas guys? Thank you.
It will be then: