How to read muxed sensor value array from StateFlow?
5 views (last 30 days)
Show older comments
Hi, I'm trying to read external sensor values which are muxed into array according to an example of an essay in StateFlow. I tried to follow the steps in "Share Parameters with Simulink and the MATLAB Workspace" page, https://au.mathworks.com/help/stateflow/ug/share-parameters-with-simulink-and-matlab-workspace.html, but found that the mask options are not available.
Here are pictures of the example I'm trying to follow, which reads the value of an array in the StateFlow:
0 Comments
Answers (1)
Ashok
on 21 Nov 2024 at 7:06
I comprehend that the Goto and From blocks are being used to send a mux signal from Simulink into a Stateflow chart. However, the From block cannot be used inside a Stateflow chart and this may hinder your attempt.
Instead, the mux signal can be passed into the chart through an input port. Firstly, create a data inside the chart using the Model Explorer as shown below and set its scope to ‘Input’. This will create an input port in the chart.
The data can also be created using the Symbols Pane inside the chart as shown below.
Once the input port is created, the mux signal can be passed through the port which can be used inside the chart, similar to an array.
The attached ‘example_R2020b.slx’ file contains a simple example which displays the elements in the mux signal as the state flow occurs.
The following command can be used in the MATLAB Command Window to read more on Stateflow charts and creating a data in Stateflow.
Stateflow charts:
web(fullfile(docroot, 'rtw/stateflow-charts.html'))
Adding data in Stateflow:
web(fullfile(docroot, 'stateflow/ug/adding-data.html'))
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!