⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree_stringrc.m

📁 Genetic Programming MATLAB Toolbox 遗传算法程序很好
💻 M
字号:
function s = tree_stringrc(tree,ix,symbols)
%Decodes the tree to string
% s = tree_stringrc(tree,ix,symbols)
%   s <- the output string
%   tree -> the tree
%   ix -> index of strating point (the root = 1)
%   symbols -> cell arrays of operator and terminator node strings
% 
% Remark: It is a recursive function.
%

% (c) Janos Madar, University of Veszprem, 2005

if tree.nodetyp(ix)==1 & ix*2+1<=tree.maxsize,
  sleft = tree_stringrc(tree,ix*2,symbols);
  sright = tree_stringrc(tree,ix*2+1,symbols);
  s = strcat('(',sleft,')',symbols{tree.nodetyp(ix)}{tree.node(ix)}, ...
      '(',sright,')');
else
  s = symbols{tree.nodetyp(ix)}{tree.node(ix)};
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -