how to display the tree structure?

조회 수: 59 (최근 30일)
Samuel Chandu
Samuel Chandu 2016년 8월 20일
댓글: Simon 2023년 10월 9일
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
Samuel Chandu
Samuel Chandu 2016년 8월 20일
Thank you Sir it works.
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