Questions tagged [stateflow]

StateFlow is a toolbox from MathWorks for development of state machines. For questions regarding the StateFlow interface from Kotlin's kotlinx.coroutines library, use the [kotlin-stateflow] tag instead.

Stateflow is an toolbox (extension) of Matlab from Mathworks. It is a commercial, and proprietary toolset.

Generally, Stateflow extends Simulink with the ability to design and test state machines. It is commonly used in control design, where algorithms can be either MATLAB scripts & formulas, Simulink blocks or embedded code (in the form of so-called S-functions).

Code generation is supported on the host platform, but for target code additional tools are required (such as Simulink Real-Time (previously known as real time Workshop) or Embedded Coder).

Advantages compared to software-only tooling (like IBM Rhapsody):

  • use with hardware (in the loop)
  • seamless integration with Simulink

Disadvantages compared to software-only tooling:

  • high license cost for code generation

Links:

131 questions
3
votes
1 answer

MutableStateFlow events being overwritten

In MyViewModel a MutableStateFlow is used to transmit events to the fragment. When the value of the MutableStateFlow is changed the earlier values are being overwritten inside the coroutine. So never received by fragment. internal class…
Lakshman Chilukuri
  • 1,067
  • 2
  • 11
  • 20
3
votes
2 answers

Call C function in matlab-simulink/stateflow

I created a C function in test.c #include int Test() { FILE * fp = fopen("C:\\workspace\\test.txt", "rw"); fprintf(fp, "test hello world"); fclose(fp); return 10; } And I defined a state in stateflow of simulink. I used…
user1192878
  • 704
  • 1
  • 10
  • 20
2
votes
1 answer

Restore view state held by state flow

Let's say that we have a simple fragment with a view based on the UI state held in StateFlow in the view model. On onCreate() we collect state as usually: override fun onCreate(savedInstanceState: Bundle?) { lifecycleScope.launchWhenStarted…
Karol Kulbaka
  • 1,136
  • 11
  • 21
2
votes
1 answer

Flow data is not showing in jetpack compose

I'm trying to get data from server and cache into database and return new fetched list to user. I'm getting response form server and saving it to the local database but when im trying to observer it from composable function it showing list is…
user15301088
2
votes
1 answer

Simulink find() does not follow resolved links

I have a Simulink model "mod" with a Subsystem "link" in it, which is actually an active (i.e. "resolved") library link. Inside this linked Subsystem there is a Stateflow Chart "chart". In Simulink I can search for the Stateflow Chart like…
walderich
  • 500
  • 1
  • 9
  • 24
2
votes
0 answers

Error in stateflow

I have a problem, when I am running my model. The error is: Error reported by S-function 'sf_sfun' in 'duo/Subsystem2/Genset1/Primover and generator/Electrical system/ SFunction ': Stateflow Suppress Error. failed assertion in…
Fanourako
  • 21
  • 1
  • 5
2
votes
2 answers

Test for compatibility in Matlab

I'm working with an open source Matlab toolbox which, according to its creators, is compatible for versions of Matlab over 7.6, i.e., R2008a. I tried to run it in R2011b and it threw the exception: Undefined variable "Simulink" or class…
2
votes
1 answer

My simple Stateflow model shows error

I'm almost new to Simulink and Stateflow. I am trying to model some simple state machines. But when trying to run the model, it shows errors (on the main Matlab screen). Warning: Input port 1 of 'sample/If' is not connected. Warning: Output port 1…
user1196937
2
votes
2 answers

Plotting multiple X,Y signals into single XYGraph matlab stateflow

i have two signals coming from my model as output each of which contain x,y values. i want to plot both of them on single xy graph window. i am able to draw it on two xy graph window but how to merge them and draw on same xy window?
bhawesh
  • 1,310
  • 2
  • 19
  • 57
2
votes
2 answers

Setting Events in Matlab/Simulink Stateflow

How can I set an event in a Simulink Stateflow (statechart) based on some value. What I mean is this. I have a variable called "choice". This "choice" comes in as an input from a simulink block.The value of choice is between 1 and 4. So all I want…
GuiccoPiano
  • 146
  • 1
  • 4
  • 12
1
vote
0 answers

Why collectAsState works only one time?

I am creating a Todo App with RoomDataBase. I want to have a dropdownmenu on home screen to select which category to be shown. The category list has All, Personal, Shopping, Wishlist and Work by default. The function for fetching all todos from db…
1
vote
0 answers

Jetpack Compose recompostion of property change in list of objects

I am quite new to Jetpack compose and have an issue that my list is not recomposing when a property of an object in the list changes. In my composable I get a list of available appointments from my view model and it is collected as a state. //…
1
vote
0 answers

Why don't UI receive StateFlow changes from ViewModel? - Android Kotlin

I am working on a practice project where I store subscribers in a room database. I use flows in the DAO and get them as stateflows later in the viewmodel. This works fine but the UI somewhy don't react when I update any subscribers (change their…
1
vote
0 answers

StateFlow value displayed using Data Binding not updating

I've switched from using LiveData to StateFlow in my app and also applied it in Data Binding. But after changing the value of StateFlow, the UI is not updating. From what I understand from the StateFlow docs, I only have to assign a new value to the…
Al Ryan Acain
  • 477
  • 8
  • 17
1
vote
0 answers

How can I get the port number of a Matlab StateFlow input given it's handle programmatically?

I have the handle of a StateFlow input from a previous find result. I'm trying to get the port number for that StateFlow input. I've been using the sf('get',[handle#],[field name]) command for other fields like 'data.name', 'data.scope', etc. For…
EricB
  • 21
  • 3
1
2
3
8 9