I am trying to create a state machine (state flow). The input is a vector.
The condition for a switch in one direction is:
[vector(vector < 494 | vector > 631)]
and for the other direction:
[vector(vector > 494 & vector < 631)]
But I get an error message in the diagnostic viewer window:
Illegal use of a matrix or vector type where a scalar was expected.
Why? But If I type these conditions in the MATLAB command window there is no error message.
Your bracket statements contain logical indexing of vector.
If you type them at the matlab prompt you will get a vector/array containing all the elments fulfilling the condition.
However, for stateflow the brackets indicate a condition for a transition and must evaluate to a single (scalar) true/false. There it makes no sense to arrive at a selection of the elements of vector.
If you are instead interested of making a transition whenever vector is less than 494 or greater than 631 the transition should look like:
And vector has to be a scalar in the stateflow context.