I'm having problems getting my while loop to work with two conditions. I'm trying to create an array that contains the numbers 3 and 7, randomizing the numbers again if it doesn't contain those two. Right now, I have this. Any ideas? Thanks!
a = zeros(1,6); a(1,1:6) = randperm(8,6) i = 0; while (a ~= 3 & a ~= 7) i = i+1; a(1,1:6) = randperm(8,6); end
Best Answer