How to dynamically create a struct?
显示 更早的评论
I want to create a struct with the number of fields decided based on some user input. What's a good way of doing this? Or should I be using a cell or matrix instead?
Thanks
采纳的回答
更多回答(1 个)
Walter Roberson
2017-2-1
TheStructure = cell2struct( cell(1, length(NamesCell)), NamesCell, 2 )
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!