function DFST = dfsa2dfst01(DFSA,acceptall) % converts a DFSA to a DFST that, upon consuming each letter % emits a 1 if that letter leads to an accept state and 0 otherwise if ~exist('acceptall','var') acceptall = 1; end DFST.ALFin = DFSA.ALF; DFST.ALFou = ['01']; DFST.Q = DFSA.Q; DFST.q0 = DFSA.q0; if acceptall DFST.F = DFSA.Q; else DFST.F = DFSA.F; end DFST = init_dfstd(DFST); for q=DFSA.Q for s=DFSA.ALF p = dfsa_delta(DFSA,q,s); if ismember(p,DFSA.F) t = '1'; else t = '0'; end DFST = set_dfstd(DFST,q,s,p,t); end end return