Strange behaviour: struct with cell values
显示 更早的评论
Hi there,
I'm writing a bigger piece of code and I am using structs as input variables. Now I changed (or tried to change) one input parameter in this struct from an array to cell. A little bit of code first:
order = 1; %Dumm
param = {1,2,zeros(2,2)};
opt1.order = order;
opt1.param = param;
opt2 = struct('order',order,'param',param);
As we can see from that bit of sample code,:opt1 is a 1x1 struct (which is what I want) and opt2 is a 1x3 struct (which I do ABSOLUTELY not want).
Why do the two lines of code behave differently?
Is there a way, that opt2 does not get expanded to a 1x3 struct?
Thanks so much!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!