How to display values from and embedded matlab function in stateflow

조회 수: 1 (최근 30일)
Joe
Joe 2013년 4월 5일
Hi everyone,
I have recently been given a project that requires the use of an embedded matlab function within a stateflow chart. I have successfully created my program and debugged all parse errors but I am getting different numerical values if I run my program within and outside stateflow. Normally I would suppress the semi-colon on the line in question but when I tried this the value did not display on the screen. It was suggested to me that I change the output of my embedded matlab function to the variable in question and display that but I cannot do this as the stateflow chart fails to run (it needs the variable I am currently outputting for the rest of the chart to work).
I was wondering if there are any ways to display results from lines of code in an embedded matlab function that resides in a stateflow chart? Any help would be greatly appreciated.
Thanks,
Joe
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2013년 4월 8일
Are you able to explicitly print the values of the variables using DISP, or set breakpoints in the Embedded MATLAB Function?

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

답변 (1개)

Siddharth
Siddharth 2013년 4월 8일
편집: Siddharth 2013년 4월 14일
Adding to Kaustubha's comment, check the inputs to the function by placing a breakpoint on the first line of the MATLAB function and then executing the Stateflow chart. Find more information about breakpoints here: http://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html#brqxeeu-182
If the input to the chart is not what you expect, check the simulation times at which the function is called. To do that, use breakpoints in the Stateflow chart. If you are using R2012b, find more about how to do this in the video below: http://www.mathworks.com/videos/integrated-debugger-70058.html

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by