"if expression, statements, end evaluates an expression, and executes a group of statements when the expression is true. An expression is true when its result is nonempty and contains only nonzero elements (logical or real numeric). Otherwise, the expression is false."
Your vectorlogical([0 0 1]) is nonempty, but it does not contain only nonzero elements. So the expression is false and the body of yourif statement is not executed.
Best Answer