EditState()
Description
Edits a state in an existing state machine.
Syntax
NewMatrix = EditState(StateMachineStruct, StateName, ParameterName, ParameterValue)
Parameters
StateMachineStruct: The state machine you are editing.
StateName: A character string specifying the name of the state you are editing.
ParameterName: A character string specifying the parameter you are editing. Valid values are:
'Timer'
'StateChangeConditions'
'OutputActions'
ParameterValue: The new value of the parameter.
Returns
A state machine struct, updated with the new parameter.
Example
% This code generates a simple state machine that drives BNC output channel 1 to 5V (high) for 1 second before exiting.
% Next, EditState is used to make the state high for 10 seconds instead of 1.
% Finally, EditState is used to make the state machine end immediately if BNC input channel 1 receives a trigger pulse during the 10 second state.
sma = NewStateMachine();
sma = AddState(sma, 'Name', 'MyState', ...
'Timer', 1,...
'StateChangeConditions', {'Tup', 'exit'},...
'OutputActions', {'BNCState', 1});
sma = EditState(sma, 'MyState', 'Timer', 10);
sma = EditState(sma, 'MyState', 'StateChangeConditions', {'Tup', 'exit', 'BNC1High', 'exit');