How to display values from and embedded matlab function in stateflow

1 visualización (últimos 30 días)
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 comentario
Kaustubha Govind
Kaustubha Govind el 8 de Abr. de 2013
Are you able to explicitly print the values of the variables using DISP, or set breakpoints in the Embedded MATLAB Function?

Iniciar sesión para comentar.

Respuestas (1)

Siddharth
Siddharth el 8 de Abr. de 2013
Editada: Siddharth el 14 de Abr. de 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

Categorías

Más información sobre Complex Logic en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by