how to display the tree structure?

57 vues (au cours des 30 derniers jours)
Samuel Chandu
Samuel Chandu le 20 Août 2016
Commenté : Simon le 9 Oct 2023
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.

Réponse acceptée

per isakson
per isakson le 20 Août 2016
Modifié(e) : per isakson le 20 Août 2016
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 commentaires
Samuel Chandu
Samuel Chandu le 20 Août 2016
Thank you Sir it works.
Simon
Simon le 9 Oct 2023
@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, ...)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur R Language dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by