- https://www.mathworks.com/help/simulink/slref/fromworkspace.html
- https://www.mathworks.com/help/simulink/ug/load-data-using-the-from-workspace-block.html
using vector as an input data for stateflow chart
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/874635/image.png)
Thank you in advance.
0 Commenti
Risposte (1)
Shanmukha Voggu
il 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!
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!