how to display the tree structure?

56 次查看(过去 30 天)
I am trying to understand how to build a tree through MATLAB. I went to the below link as suggested my MATLAB for understanding this concept. http://tinevez.github.io/matlab-tree/TreeDemo/TreeDemo_creating.html
In that they specified that for displaying the tree the following code should be used:
disp(t.tostring)
this appears after that
No appropriate method, property, or field 'tostring' for class 'tree'.
in the above link they gave tostring.m so I added this to current folder but still the same thing appears:
No appropriate method, property, or field 'tostring' for class 'tree'.
appreciate your time,
thanks, Samuel.

采纳的回答

per isakson
per isakson 2016-8-20
编辑:per isakson 2016-8-20
You provide too little information to spot the cause of your problem. How did you create the tree, t?
I think the documentation of this class is good.
This example is copied from the documentation. (The class is installed on my machine.)
>> lineage = tree.example;
>> t = lineage.subtree(19);
>> disp(t.tostring)
EMS
+---------+----+
| |
MS E
+-+--+ +----+----+
| | | |
MSa MSp Ea Ep
+-+--+ +-+--+
| | | |
Eal Ear Epl Epr
and
>> disp(lineage.tostring)
Zygote
+-----------------------------+----------------------------+
| |
AB P1
+-------------+-------------+ +-------------+---------------+
| | | |
ABa ABp P2 EMS
+------+------+ +------+------+ +--------+-----+ +---------+----+
| | | | | | | |
ABal ABar ABpl ABpr P3 C MS E
+--+---+ +--+---+ +--+---+ +--+---+ ++----+ +----+----+ +-+--+ +----+----+
| | | | | | | | | | | | | | | |
ABala ABalp ABara ABarp ABpla ABplp ABpra ABprp P4 D Ca Cp MSa MSp Ea Ep
+-+-+ +-+--+ +-+--+ +-+--+ +-+--+
| | | | | | | | | |
Z2 Z3 Caa Cap Cpa Cpp Eal Ear Epl Epr
>>
&nbsp
I guess, something is wrong with your installation of the class, tree. You should just copy the folder, @tree, and all of it's content to a folder that is in the Matlab search path.
Verify that Matlab finds tree
>> which tree
H:\m\FEX\InUse\TreeDataStructure\@tree\tree.m % tree constructor
  2 个评论
Simon
Simon 2023-10-9
@per isakson Thanks for your tree class. It seems to be what I need. What I want to do is design a couple folder trees for my project. I have tried some flowchart and mindmap apps. They are not flexible to manipulate so not helpful for experimenting with different kind of folder tree. I am going to try your tree class out.
BTW, when you do a large umbrella project, under which there are large subprojects. The subprojects should be done sequentially. Do you have any suggestion for better folder structure? My first layout is project 1 (code, data, figure, ...), project 2 (code, data, figure, ...). Second layout is code (project 1, project 2, ...), data (project 1, project 2, ...), and figure (project 1, project 2, ...)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 R Language 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by