Stateflow: function call during action v/s fuction call during condition check
이전 댓글 표시
I am working on State flow in which I am calling a function "func1" and assigning the output of that function to a Variable "Temp". After that performing the conditional check by using another function "func2(Temp)" by passing the "Temp" variable to it.
The problem is func2 is using the old value of Temp but not the latest value of Temp=func1() (which is assigned at current event).
Using the debugger I figured it out that func2() is called before the func1().
MATLAB is calling func2() first because to perform the conditional check and decide the path. After decide the path it calls the function func1();
Is there any solution by which I can use the value of "Temp" for the conditional check.
Temp = func1();
if func2(Temp) % code end
댓글 수: 1
Kushagra
2013년 5월 4일
You have not mentioned where are you calling these functions inside a state (entry action, during action or some transition). Try calling these functions on transitions and call func1 at a transtion that is going to be executed first.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 General Applications에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!