How to read muxed sensor value array from StateFlow?

5 visualizaciones (últimos 30 días)
Jingzhe Xue
Jingzhe Xue el 30 de Sept. de 2020
Respondida: Ashok hace alrededor de 8 horas
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:

Respuestas (1)

Ashok
Ashok hace alrededor de 8 horas
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'))

Categorías

Más información sobre Stateflow en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by