using vector as an input data for stateflow chart

조회 수: 5 (최근 30일)
Kacper Witasinski
Kacper Witasinski 2022년 1월 26일
답변: Shanmukha Voggu 2022년 3월 11일
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.

답변 (1개)

Shanmukha Voggu
Shanmukha Voggu 2022년 3월 11일
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!

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by