1

私は正常に動作する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.

4

2 に答える 2

1

flowはMatlab関数です。それが問題かもしれません。その変数の名前を変更してみてください

于 2013-09-19T15:06:05.277 に答える
1

0空の行列ではなく、変数を初期化します[]

flowDt = [];

それから

flowDt = 0; was the solution

そのためflowDt = 0、配列を初期化し、それを作成しますnot empty

于 2013-09-19T15:11:09.347 に答える