- Iterate over your TreeNode structures to extract the necessary information.
- Store the extracted information in a structure array or cell array.
- Use "writestruct" or "writecell" to save the structured data into a ".dat" file.
- https://www.mathworks.com/help/matlab/ref/writestruct.html
- https://www.mathworks.com/help/matlab/ref/writecell.html