-
Notifications
You must be signed in to change notification settings - Fork 0
/
setNodeNextState.m
31 lines (28 loc) · 1.1 KB
/
setNodeNextState.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function nodeUpdated = setNodeNextState(node)
% SETNODENEXTSTATE Look up next state for each node and update "nextState" field of the NODE
% structure-array. Make sure that assocRules() has been called on NODE before using this function.
%
% SETNODENEXTSTATE(NODE) returns the updated node structure-array containing
% next-state information for each node.
% Next state information is stored in the "nextState" field of the NODE structure-array.
%
% Input:
% node - 1 x n structure-array containing node information
%
% Output:
% nodeUpdated - 1 x n structure-array containing updated node information
%
%
% Author: Christian Schwarzer - SSC EPFL
% CreationDate: 13.11.2002 LastModified: 20.01.2003
if(nargin == 1)
nodeUpdated = node;
for i=1:length(node)
nodeUpdated(i).nextState = nodeUpdated(i).rule(nodeUpdated(i).lineNumber,1);
if(isempty(nodeUpdated(i).nextState))
nodeUpdated(i).nextState = nodeUpdated(i).state;
end
end
else
error('Wrong number of arguments. Type: help setNodeNextState')
end