- #1
magma_saber
- 73
- 0
Homework Statement
switch statements. y is an integer number. Use a switch statement to set B equal to one of the following values: true, false, or the vector [1 0 1]. If y is {1,2,3,5,7}, then set B to true. If y is {4, 6, 8, 10}, then set B to false. If y is neither, then set B to the vector [1 0 1]. You must use a switch statement to solve this problem and your answer should be stored in the variable named "B".
Homework Equations
The Attempt at a Solution
B='true'
switch B
case '{1,2,3,5,7}'
y=true
case '{4, 6, 8, 10}'
y=false
otherwise
y=[1 0 1]
end
i tried that and it said it was wrong. a file was provided that tells you if its wrong.