Rapid Stateflow.Transition finding
1 次查看(过去 30 天)
显示 更早的评论
Is there a rapid way to find all the 'Stateflow.Transition' from a state A, to a state B?
0 个评论
采纳的回答
Siddharth
2013-5-30
You can do that using a simple MATLAB script using the Stateflow API. Find the Stateflow API below: http://www.mathworks.com/help/stateflow/programmatic-manipulation.html
Here is a simple example that looks for transitions between the states "upshifting" and "steady_state". To run the example, open the model sf_car and run the following code:
rt = sfroot;
transArray = rt.find('-isa','Stateflow.Transition');
len_transarray = length(transArray);
x = zeros(len_transarray,1);
y = zeros(len_transarray,1);
for i = 1: len_transarray
if ~isempty(strfind(get(get(transArray(i),'Source'),'LabelString'),'upshifting'))
x(i) = i;
end
if ~isempty(strfind(get(get(transArray(i),'Destination'),'LabelString'),'steady_state'))
y(i) = i;
end
end
output = transArray(find(x>0 & y > 0))
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!