I am trying to read some variables calculated in a Matlab Function defined in stateflow without calling them locally by the variable names and function name. A simple stateflow program is shown below.
In the stateflow chart, I have defined two Matlab functions to calculate the mean, sum and std.
These two functions are written as below.
function [meanv, sumv] = meanstats(vals)
function stdev = stdevstats(vals)
stdev = std(vals);
I modified the representation a bit as:
But, I want to access the outputs or Calculated values of the Functions without calling them in the State together with the FunctionName but just executing the function only, as below. But those output calculations should be displayed out of the state machine, and will be used in different calculations.
How can I define any variable globally in a Matlab Function that is to be accessed from anywhere in the program, because in the real program I have to define many variables within the same function?