Pass bus signals to a function as an array (Stateflow)
Hello!
I’m working within stateflow and defining a transition check:
[checkInRange(User_CMDs.r,0,1)==1]
Check In range is a simple function as follows and returns true if all inputs are true (In Range):
function result = checkInRange(input,request,tolerance)
result = abs(request – input) <= tolerance;
result = all(result(:));
end
Ive been able to pass arrays as input to the function, however i am trying to define a transition and for a state within simulink. The User_CMD.r is a bus with 4 singals called X1, X2, X3 and X4. I need all of these to be in range for state transition. Is there a way of doing this without doing it as below?
[checkInRange([User_CMDs.r.X1,User_CMDs.r.X1,User_CMDs.r.X1,User_CMDs.r.X1], 0,1)==1]Hello!
I’m working within stateflow and defining a transition check:
[checkInRange(User_CMDs.r,0,1)==1]
Check In range is a simple function as follows and returns true if all inputs are true (In Range):
function result = checkInRange(input,request,tolerance)
result = abs(request – input) <= tolerance;
result = all(result(:));
end
Ive been able to pass arrays as input to the function, however i am trying to define a transition and for a state within simulink. The User_CMD.r is a bus with 4 singals called X1, X2, X3 and X4. I need all of these to be in range for state transition. Is there a way of doing this without doing it as below?
[checkInRange([User_CMDs.r.X1,User_CMDs.r.X1,User_CMDs.r.X1,User_CMDs.r.X1], 0,1)==1] Hello!
I’m working within stateflow and defining a transition check:
[checkInRange(User_CMDs.r,0,1)==1]
Check In range is a simple function as follows and returns true if all inputs are true (In Range):
function result = checkInRange(input,request,tolerance)
result = abs(request – input) <= tolerance;
result = all(result(:));
end
Ive been able to pass arrays as input to the function, however i am trying to define a transition and for a state within simulink. The User_CMD.r is a bus with 4 singals called X1, X2, X3 and X4. I need all of these to be in range for state transition. Is there a way of doing this without doing it as below?
[checkInRange([User_CMDs.r.X1,User_CMDs.r.X1,User_CMDs.r.X1,User_CMDs.r.X1], 0,1)==1] stateflow, signal bus, bus MATLAB Answers — New Questions