using vector as an input data for stateflow chart

4 views (last 30 days)
Hello,
I have two arrays called time and velocity. Both are 4001x1 'double'. I would like to use them as an input data for stateflow chart to perform transitions between states depending on the current value from both arrays. After creating conditions for transitions between states, stateflow chart has now two inputs for input data (obviously). What is the way to use this arrays as an input data? 'From workspace' does not work. Following error is returned:
" Invalid matrix variable specified as workspace input in 'model/From Workspace'. The matrix data must be a real, double, have two dimensions, and at least two columns. The first column must contain time values and the remaining columns the data values. Matrix values cannot be Inf or NaN. "
My stateflow scheme looks like this:
Thank you in advance.

Answers (1)

Shanmukha Voggu
Shanmukha Voggu on 11 Mar 2022
Hi Kacper,
I understood you got the following error, when you are trying to read a matrix from the Base Workspace using 'From Workspace' block.
" Invalid matrix variable specified as workspace input in 'model/From Workspace'. The matrix data must be a real, double, have two dimensions, and at least two columns. The first column must contain time values and the remaining columns the data values. Matrix values cannot be Inf or NaN. "
As the error states, a 'From Workspace' block is intended to be used for time-varying signals and it must require matrix with at least two columns So, we cannot use matrix with only one column. Refer to below links to know more about 'From Workspace' block.
To resolve the issue in this case, a 'Constant' block should be used instead:
Hope this helps!

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!