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
0
votes
0 answers

Simulink function in Stateflow error

I have multiple subsystems each of which have State machines "Stateflow". One subsystem has FSM, inside one state there is a simulink function that is supposed to start "simulink model representing an ODE" when in that state , a solution is observed…
Sam Gomari
  • 733
  • 4
  • 13
  • 37
0
votes
1 answer

Copy stateflow in a Simulink model

I would like to copy a Stateflow chart The command: Simulink.SubSystem.copyContentsToBlockDiagram(subsys, bdiag) doesn't work on a Stateflow chart alone, rather then only on subsystems. How could I copy a selected Stateflow to another system?
Eagle
  • 3,362
  • 5
  • 34
  • 46
0
votes
3 answers

matlab stateflow vs. Rhapsody

In Rhapsody - after creating a class, one can create many similar objects (instances) of that class. In matlab's stateflow tool - one can create a state which is, as far as I know, an object. Is there a possibility to use a state in matlab's…
Dana
  • 1
  • 2
0
votes
1 answer

Matlab stateflow else transition

I have a Stateflow with state that handles the following pseudo code: if input1==1 then new_state=state2; else if input==2 then new_state=state3; else new_state=error_state; end if; How to model the else in Stateflow? Currently I'm using…
judoka_acl
  • 375
  • 2
  • 22
0
votes
1 answer

MATLAB Stateflow `ml` error (C vs MATLAB language)

I'm trying to use ml function in Stateflow. because of misunderstanding of my mistake I try example from help: http://www.mathworks.com/help/stateflow/ug/calling-built-in-matlab-functions-and-accessing-workspace-data.html "Which ml Should I Use?"…
Mikhail_Sam
  • 10,602
  • 11
  • 66
  • 102
0
votes
1 answer

Shift array in stateflow

I want to shift an array within stateflow by one element. In matlab, I would use circshift or this code: >> x = [1:5] x = 1 2 3 4 5 >> x(2:end) = x(1:end-1) x = 1 1 2 3 4 >> x(1) = 0 % New Value x = 0 …
amw
  • 452
  • 1
  • 5
  • 14
0
votes
1 answer

Counting Number of states in StateFlow

How can I counting number of states in a stateflow diagram via M-Script(hierarchically)?
0
votes
1 answer

provide time simulation in the stateflow chart

I would like to get the simulation time when I simulate my stateflow program, and I do not know which command can give me the time at each step of runing. Can you help me. Thank you.
0
votes
1 answer

reuse C code in simulink

Is it possible that I call a c program from a stateflow chart, then I copy this chart, still in this same model, and execute both with out any conflict? For example a C program like this: int var; // var is global int myfunction(int…
zrs5532
  • 1
  • 2
0
votes
2 answers

How can I save output from Simulink?

I'm a student learning to use MATLAB. For an assignment, I have to create a simple state machine and collect some results. I'm used to using Verilog/Modelsim, and I'd like to collect data only when the state machine's output changes, which is not…
John
  • 3,430
  • 2
  • 31
  • 44
0
votes
2 answers

Determine size of Stateflow Subchart

I am writing a Model Advisor check right now and I need to know the size of a subcharted Stateflow State or Box. But the "Stateflow.State" and "Stateflow.Box" objects only have a "Position" attribute, which gives their position inside their parent…
walderich
  • 500
  • 1
  • 9
  • 24
0
votes
1 answer

Why is Matlab Stateflow 7.7 not throwing errors on undefined variables?

Previously in Matlab Stateflow 7.1 all variables and functions had to be included before they can be referred to in the state diagram or else it would throw an error when you tried to parse the diagram. But now in 7.7 it doesn't catch those kinds of…
Pyrolistical
  • 27,624
  • 21
  • 81
  • 106
0
votes
1 answer

Simulink C/C++ code generation for parallel (AND) states

I have a basic question; sorry, it might be very silly and generic, but is very important for our knowledge. How is the C/C++ generated code implemented for parallel (AND) states? Does it implement them using multi-threaded approach? I have…
Tina J
  • 4,983
  • 13
  • 59
  • 125
0
votes
1 answer

MATLAB C/C++ code generation error

I'm trying to build my simple Stateflow/Simulink design into C/C++, but I get this error. I used code generation before, but I don't know for this design it shows errors. Does anybody know what is wrong? And here, is my model.
user1196937
0
votes
1 answer

Stateflow is not working with Matlab

I cannot run state flow diagram from Matlab. I am using Matlab 2013b. Whenever I try to run it it gives a warning: Warning: The model 'xyz' does not have continuous states, hence Simulink is using the solver'FixedStepDiscrete' instead of solver …
user3193794
  • 105
  • 2
  • 12
1 2 3
8
9