I'm using Stateflow (Matlab R2016b) with a vector output signal. The usage of matlab action language is hard to understand.
- Set a value for whole array
Within matlab I use:
>> x = ones(1,3)
x =
1 1 1
>> x(:) = 2
x =
2 2 2
to set all values to a specific value. But within stateflow i get following error
Inferred size ('scalar') for data 'x' does not match specified size ('[1 3]').
So, i have to use in stateflow
x = 2*ones(1,3)
Is there any other way of easy access to all elements?
- Change dynamically some of the values
Within matlab I can run
x(myStartIndex:end) = 5
But within stateflow, that gives me the error
Could not determine the size of this expression.
I don't think that building for-loops within statelow is a proper coding style.
Thanks in advance.