【问题标题】:How to equate a structure array to structure array如何将结构数组等同于结构数组
【发布时间】:2013-05-11 03:39:32
【问题描述】:

以下代码不起作用,但我想我想做什么很清楚:

my.struct = 1;
foo.bar = my.struct;

这样

foo.bar.struct = 1

基本上我想用一堆字段和值填充my 结构数组。然后我想将该结构作为嵌套结构放置在foo.bar 中,同时保留字段名称。

【问题讨论】:

  • 您在谈论数组,但我在您的示例代码中没有看到任何内容。您确定您正在处理数组吗?

标签: matlab octave


【解决方案1】:
my.struct = 1;
foo.bar = my.struct;

这只是将my.struct (=1) 的值放在foo.bar 中。当然foo.bar 就是1

我想你在追求这个:

my.struct = 1
foo.bar = my;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 2019-04-04
    • 2015-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多