tree2str.m

来自「遗传规划的matlab工具箱」· M 代码 · 共 24 行

M
24
字号
function str=tree2str(tree)
%TREE2STR    Translates a GPLAB algorithm tree into a string.
%   TREE2STR(TREE) returns the string represented by the tree,
%   in valid Matlab notation, ready for evaluation.
%
%   Input arguments:
%      TREE - the tree to translate (struct)
%   Output arguments:
%      STRING - the string respresented by the tree (string)
%
%   See also MAKETREE
%
%   Copyright (C) 2003-2004 Sara Silva (sara@dei.uc.pt)
%   This file is part of the GPLAB Toolbox

str=tree.op;
args=[];
for k=1:length(tree.kids)
   args{k}=tree2str(tree.kids{k});
end
if ~isempty(args)
	str=strcat(str,'(',implode(args,','),')');
end

⌨️ 快捷键说明

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