How can I find the values in a struct array tree structure

3 visualizzazioni (ultimi 30 giorni)
I have a tree structure, each node of the tree structure is a struct array. For example, this the tree structure and each node is a strcut array with fields (name, X, Y, Z) and values. I need to find the distance between 'D1' to 'B' and similarly 'D2' to 'B' and 'D3' to 'B'.
Can you help me ? thanks in advance
  2 Commenti
Jan
Jan il 11 Set 2019
Please post some example code, which creates the "tree structure". The current description is too vague to post some code. E.g. struct do not have values, but only the fields of the structs do. I guess you are talking of a struct array, which has the fields 'name', 'X', 'Y' and 'Z'. But how is "parent" defined here? What is "the path from the node to the parent"?
Adam Danz
Adam Danz il 11 Set 2019
That picture might help but I'm still lost.
"each node is a [structure] array with fields (name, X, Y, Z) and values."
Are you talking about variables that are from the class "struct" like this (link below)?
"I need to find the distance between 'D1' to 'B' and similarly 'D2' to 'B' and 'D3' to 'B'. "
Where are the coordinates / positions stored? We're still very much in the dark, here.

Accedi per commentare.

Risposte (1)

Ram Kumar
Ram Kumar il 11 Set 2019
The coordinates are stored in a struct array, much like the link you have mentioned. I have attached 2 pictures, I hope it's a bit more about the problem statment.tree.png
Picture1.png

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by