Create path of position vectors stored in a structure with sub structures

1 view (last 30 days)
I have a structure 'node' that contains a position vector in node.pos and two sub structures 'child1' and 'child2'. Each sub structure looks exactly like its parent structure containing its own position in node.child1.pos (or node.child2.pos) and two children node.child1.child1 (or node.child1.child2, node.child2.child1 and so on). This creates a tree structure with n branches. However branches have varied lenghts.
The purpose: I would like to save all paths of positions vectors in a cell array that looks like this:
Array = { {path1}; {path2}; {path3}; ... }
I think this can be solved with a recursive function but I am not sure how.
I attached a file node that contains an example structure.

Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!