How can I add an input to a Stateflow chart?

조회 수: 1 (최근 30일)
João
João 2014년 3월 27일
댓글: João 2014년 3월 27일
I've been using the Stateflow library, but I can't create an input to a chart with the API.
sfnew('MyChart');
root = sfroot;
blockDiagram = root.find('-isa','Simulink.BlockDiagram');
chart2 = blockDiagram.find('-isa','Stateflow.Chart');
How can I add an input to the chart? I've tried the add_param function but without success...
Thanks
  댓글 수: 1
João
João 2014년 3월 27일
I managed to do something about my question:
% Initialization
sfnew('MyChart');
root = sfroot;
blockDiagram = root.find('-isa','Simulink.BlockDiagram');
chart = blockDiagram.find('-isa','Stateflow.Chart');
chart.Name = 'Connector';
%chart.Position = [40 40 100 60];
input = Stateflow.Data(chart);
input.Scope = 'INPUT_DATA';
input.Name = 'LuxLevel';
output = Stateflow.Data(chart);
output.Scope = 'OUTPUT_DATA';
output.Name = 'State';
With this, it is possible to set variable to input and output.
I've another question: how can I insert a Light Bulb block by code?
For a Manual Switch I can do this:
switch1 = add_block('Simulink/Signal Routing/Manual Switch','MyChart/sw');
For a Light Bulb I don't know how can I do it, since I can't use this for example:
add_block('Gauges Blockset/Global Majic ActiveX Library/On Off Gauges/Light Bulb','MyChart/Light');

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Stateflow에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by