不支持矩阵编码器订阅空矩阵

时间:2013-09-19 15:03:38

标签: matlab matrix matlab-coder

我有一个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.

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

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

flowDt = [];

然后

flowDt = 0; was the solution

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

相关问题