Real time vector saving
Show older comments
Dear all,
I am using xPC with R2014b version and in my model I have a state machine that in one state there is a function with two inputs coming from 2 sensors. I want to save all the values of the inputs into 2 vectors (eg. 10,1) that I will use in an other state.
Until now I used a persistent variable for the index for the vectors. My question is: how is it possible to save the 2 vectors and use them in the next state?
Bests, Stergios
5 Comments
Geoff Hayes
on 30 Sep 2016
Stergios - are you using Simulink?
Stergios Verros
on 3 Oct 2016
Guillaume
on 3 Oct 2016
So I've added Simulink under Products
Stergios Verros
on 3 Oct 2016
Stergios Verros
on 3 Oct 2016
Answers (2)
Gareth Thomas
on 3 Oct 2016
0 votes
If I understand you correctly you have a stateflow chart, in which one state you are calculating some parameters for a polyfit and you want to send them to another state based on a particular condition.
Have you looked into Events in Stateflow? One can broadcast events with data to another states.
1 Comment
Stergios Verros
on 3 Oct 2016
Brandon Eidson
on 6 Oct 2016
0 votes
Hey Stergios,
One way to save variables in one state that can be used in another state is by using the "Data Store Memory" block and its associated blocks. I have provided the link to its documentation below as well as a link to information on how to use this block in Stateflow.
Also, if you are using C for your Stateflow Action Language, note that the scope of variables can be handled differently. A list of some of the differences is found at the link below.
Categories
Find more on Multicore Processor Targets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!