It's not possible for a number to be simultaneously less than 6 and greater than 12:
while margin<6 && margin>12
Did you mean this (less than 6 OR greater than 12)?
while margin<6 || margin>12
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!