Questions tagged [stateflow]

StateFlow is a toolbox from MathWorks for development of state machines

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 real time Workshop).

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

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

Disadvantages compared to software-only tooling:

  • cost for code generation

Links:

81 questions
0
votes
1 answer

multiple return variables from graphical function in stateflow

I'm using stateflow graphical function and one of my return parameters are not updated after exiting the function. I'm using matlab as my default code language. Is it possible to return more than one variable from a graphical function? What is the…
Yair R
  • 1
0
votes
1 answer

Visualizing a Stateflow Model

I have a pretty simple MATLAB stateflow model that I would like to visualize. I don't need anything fancy - even if I could just display a different image based on which substate a parallel state is in. Does anyone have any suggestions about what I…
0
votes
0 answers

Stateflow access array elements in matlab action language

I'm using Stateflow (Matlab R2016b) with a vector output signal. The usage of matlab action language is hard to understand. Set a value for whole array Within matlab I use: >> x = ones(1,3) x = 1 1 1 >> x(:) = 2 x = 2 2 …
amw
  • 392
  • 3
  • 10
0
votes
1 answer

Simulink Stateflow - 'after' condition not precise?

I implemented an integrator (grounded capacitor driven by piece-wise constant current source) using Stateflow and the 'after' condition. See code. With the given setting the capacitor should change its voltage every 1 sec, but does so about every…
bardo
  • 111
  • 6
0
votes
1 answer

How to generate .NET DLL Library from Simulink and Stateflow

How can Simulink and Stateflow models be compiled into a .NET shared DLL library? Is this a feature of Matlab? Is there a specific version or Matlab package required? I am currently using Matlab 2017a on Windows 7. Any starting points would really…
sammy
  • 67
  • 2
  • 7
0
votes
0 answers

How to design a counter with reset in simulink and stateflow

Design a counter that decrements and increments by 1 with rest option which means it rests to zero and starts the counting from one.this problem should be done using both simulink and stateflow.
Yo Yo
  • 1
  • 1
0
votes
2 answers

Find a junction by its number in Stateflow

I'm developing an embedded system in MATLAB Simulink which contains some Stateflow charts. I successfully generate C-code out of it. Unfortunately, building the model throws up some warnings. One of them is: Warning: Junction #1277 does not have an…
c-a
  • 82
  • 1
  • 11
0
votes
1 answer

Write to DataStore from Matlab script

So what I'm trying to do is this: I have a simulink stateflow model. To display some stuff from this model I built a GUI. In this GUI I have a button that should set a flag to true when pressed, which I want to use inside my stateflow model to start…
Vince
  • 1,479
  • 2
  • 16
  • 39
0
votes
1 answer

Matlab Stateflow - after() function on transition not working

In my Stateflow model the after() function is not working. If i put for examle after(10,sec) there is no delay in the states, it switches directly from on to the next. I use a Pulse Generator as an eternal clock for Stateflow with following…
Robin
  • 303
  • 1
  • 2
  • 15
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
  • 593
  • 2
  • 11
  • 27
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
  • 2,996
  • 4
  • 29
  • 42
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
  • 355
  • 2
  • 20
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
  • 7,481
  • 10
  • 37
  • 71
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
  • 392
  • 3
  • 10