【问题标题】:Subscripting into an empty matrix is not supported matrix coder矩阵编码器不支持下标为空矩阵
【发布时间】:2013-09-19 15:03:38
【问题描述】:

我有一个 matlab 文件,工作正常,

我正在尝试使用自动编码器对其进行转换,但出现错误,

??? Subscripting into an empty matrix is not supported.

ct = 0;
while i <= 1800
        [xx, cc, vv] = doSomething(x, somevalue, Param1, dt);
        %things happening ...
        if something
           flowDt(ct+1) = vv;
           ct = ct + 1;
        end
end

然后我尝试在循环之前声明它,因为我遇到了一个错误: ??? Undefined function or variable 'flowDt'.'

flowDt = [];
ct = 0;
while i <= 1800
        [xx, cc, vv] = doSomething(x, somevalue, Param1, dt);
        %things happening ...
        if something
           flowDt(ct+1) = vv;
           ct = ct + 1;
        end
end

现在我不知道是什么导致了这个问题: ??? Subscripting into an empty matrix is not supported.

【问题讨论】:

  • 你试过flowDt = 0而不是[]吗?
  • 这有点解决它,但是,我做了两个 [] 然后使它等于 0,解决了。您可以发布答案

标签: matlab matrix matlab-coder


【解决方案1】:

将您的变量初始化为0,而不是空矩阵[]

flowDt = [];

然后

flowDt = 0; was the solution

所以flowDt = 0 将初始化数组,使其成为not empty

【讨论】:

    【解决方案2】:

    flow 是一个 Matlab 函数。这可能是问题所在。尝试更改该变量的名称

    【讨论】:

    • 对不起,我缩短了命名,
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-05
    • 2012-04-16
    • 1970-01-01
    • 2016-12-03
    • 2018-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多