📄 disrule.m
字号:
function disrule(dos,ltot,lns,lnei)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DISRULE: Write CA rules
%
% Fist Coded 28 March 1997
% Last Modefied 20 August 1997
%
% Copyright (c)
% T. Suzudo JAERI-CAIL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dos : Dimension of space
% tot : 1:totalistoc 2:outer-totalistic 3:general
% lns : states per site
% lnei : number of neighbors
clear tit1;
% load rule
if dos==1
load c:\ecody\rule1
elseif dos==2
load c:\ecody\rule2
elseif dos==3
load c:\ecody\rule3
end
% Serach code
if ltot==1
code=eval(['tr_code' num2str(dos) num2str(lns) num2str(lnei)]);
elseif ltot==2
code=eval(['otr_code' num2str(dos) num2str(lns) num2str(lnei)]);
elseif ltot==3
if dos==1 code=eval(['r_code' num2str(dos) num2str(lns) num2str(lnei)]);
elseif dos==2 code=eval(['sym_code' num2str(dos) num2str(lns) num2str(lnei)]);
end
end
%If number of states is 2
if lns==2
if ltot==1
scode=bin2dec(code(1:(lnei+1)/2));
lcode=bin2dec(code((lnei+1)/2+1:lnei+1));
tit1=['s-code: ' num2str(scode) ' l-code: ' num2str(lcode)];
elseif (ltot==2)
zerocode=bin2dec(code(1:lnei));
onecode=bin2dec(code(lnei+1:2*lnei));
tit1=['0-code: ' num2str(zerocode) ' 1-code: ' num2str(onecode)];
elseif ltot==3&dos==2
zerocode=bin2dec(code(1:6));
onecode=bin2dec(code(7:12));
tit1=['0-code: ' num2str(zerocode) ' 1-code: ' num2str(onecode)];
else ltot==3
tit1='';
for i=1:lns^lnei
if code(i) tit1 =[tit1 ' ' decode(i,lns,lnei)]; end
end
end
% When ns==3
elseif lns==3
clear title1 leng
for i=1:2
str1='';
for ii=1:lns^lnei
if code(ii)==i str1 = [str1 ' '...
decode(ii,lns,lnei)];
end
if isempty(str1) str1= ' '; end
leng(i)=size(str1,2);
title1(i,1:leng(i))=str1;
end
end
tit1=[title1(1,1:leng(1)) '->1 ' title1(2,1:leng(2)) '->2'];
else
tit1='ERROR: Invalid Number of Cell State';
end
% Write on the display
title(tit1,'fontsize',8);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -