Clear Filters
Clear Filters

How to display values from and embedded matlab function in stateflow

1 view (last 30 days)
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 Comment
Kaustubha Govind
Kaustubha Govind on 8 Apr 2013
Are you able to explicitly print the values of the variables using DISP, or set breakpoints in the Embedded MATLAB Function?

Sign in to comment.

Answers (1)

Siddharth
Siddharth on 8 Apr 2013
Edited: Siddharth on 14 Apr 2013
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

Categories

Find more on Complex Logic in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!