How can I find the values in a struct array tree structure
조회 수: 3 (최근 30일)
이전 댓글 표시
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
Jan
2019년 9월 11일
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
2019년 9월 11일
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.
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

