matlab coder report Size mismatch (size [0 x 0] ~= size [1 x 2])

223 Views Asked by At

I tried to use matlab coder to convert my matlab file into C\C++ source file. In my *.m file,I defined a dynamic array:

...
...
coord_list = [];
I_list = [];

...
for i=1:n
    ....
    coordinate = yy;
    I = zz;
    coord_list = [coord_list;coordinate];
    I_list = [I_list;I]
    
    %% handle with coord_list and I_list
    coord_list = f(coord_list);
    I_list = g(I_list);
    
    %% the iteration stopped if the condition is meet
    if condition 
        break
    end    
end

The error occurs like:

??? Size mismatch (size [0 x 0] ~= size [1 x 2]).
The size to the left is the size of the left-hand side of the assignment.

How could I fix this bug? how should I modify my Matlab code so that It meets the requirements of C\C++ style for Matlab-coder?

BTW, zero is a reasonable value for coordinate.

0

There are 0 best solutions below