Adding fields to a struct?
显示 更早的评论
I have an existing struct titled PR1Data. I would like to add a new field titled 'filename' to the structure, why is this so difficult to do? I only want the field to exist, i have tried the following methods with no results:
PR1Data=setfield(PR1Data,'filename',[1 2])
error: 'scalar structure required for this assignment'
PR1Data.filename='';
Same error
How can i simply add a new field to an existing struct?? this should not be this difficult
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!