function print_dfsa(DFSA,fname) if ~exist('fname','var') fname = inputname(1); end DS = deadstate_dfsa(DFSA); fprintf('Information for DFSA " %s":\n',fname); fprintf('Alphabet: "%s"\n',DFSA.ALF); fprintf('The states Q: %s\n',num2str(DFSA.Q)); fprintf('Start state: %d\n',DFSA.q0); fprintf('Accepting states: [%s]\n',num2str(sort(DFSA.F))); fprintf('Dead states: %s\n',num2str(DS)); %for q = DFSA.Q for q = setdiff(DFSA.Q,DS) % the new, more convenient to view way [rr,ss] = get_ddelta(DFSA,q); % don't show dead state transitions %x = find(~ismember(rr,DS)); % DO show deadstate transitions x = find(rr); rr=rr(x); ss=ss(x); ru = unique(rr); if ~isempty(ru) for r=ru x=find(r==rr); S=ss(x); fprintf('(%3d,%5s) -> %3d \n',q,S,r); end end % the old way %for s = DFSA.ALF % r = dfsa_delta(DFSA,q,double(s)); % %if (r~=DFSA.qd) % %hack to avoid printing dummy state: % %if ((r~=69)&(s~=69)) % fprintf('(%3d,%s) -> %3d \n',q,s,r); % %end %end end return