Reputation: 860
I have a matlab file, working fine,
I am trying to conver it using auto coder, however I get an error,
??? 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
I tried then to declare it before the loop because I got an error:
??? 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
now I am stuck not knowing what is causing this issue:
??? Subscripting into an empty matrix is not supported.
Upvotes: 1
Views: 564
Reputation: 45752
Initialize your variable as 0
rather than an empty matrix []
flowDt = [];
then
flowDt = 0; was the solution
so flowDt = 0
will initialize the array, making it not empty
Upvotes: 1
Reputation: 112699
flow
is a Matlab function. That could be the problem. Try changing that variable's name
Upvotes: 1