How to populate a tree with a struct with different depth?
7 ビュー (過去 30 日間)
古いコメントを表示
I want to import structured signal data from another software and let the user browse and select in a GUI. The imported data contains only the individual name of each signal like so:
plant.tree.fruit.apple
plant.tree.veg.olive.oil
plant.grass.mint
As you see all levels are already separated by dots, but they're all strings and not actual struct.
So far I have successfully turned them into a proper struct, but now I don't know how to populate a tree object with it. The goal is to let the user expand and collapse nodes to find the signal they want in a GUI.
4 件のコメント
Stephen23
2022 年 6 月 2 日
"How to populate a tree with a struct with different depth?"
Answer: loop over the fields at each level of the nested structures. A general solution requires a recursive function.
What have you tried so far?
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!