matlab tree 结构


From matlab: matlab tree

将该链接中的文件包下载,解压,然后将@tree copy到正在编辑的文件夹中,即可使用


使用要点记载:

1.添加根节点: 

t = tree(' I am the root')

其中,‘I am the root’ 为根节点所存储的内容


2.添加节点

t = t.addnode(1,'I am the left child of root')

1表示parent节点的index,‘I am the left child of root’为该节点上存储的内容

PS:   因为tree class的定义不是继承handler类,因此必须使用 t = t.addnode(), 单纯t.addnode() 是不会更改t的

PS:节点存储内容为cell类型,即为可变长度的content,根据我的实验需要,我想把它改成某种自定义的数据结构(还未行动)


【t node1】 = t.addnode(1,'I am node1');
其中,返回值node1表示新添加的节点node1对应的index


3.得到某节点上存储的content

t.get(node1)




  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值