matlab coder report Size mismatch (size [0 x 0] ~= size [1 x 2])
이전 댓글 표시
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]
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?
댓글 수: 1
Chiluveru
2023년 2월 13일
hi Raghu,
I am alsp facing same issue like the error below:
Size mismatch (size [1 x 0] ~= size [16 x 0]).
need your help for solving it
채택된 답변
추가 답변 (1개)
Raghu Boggavarapu
2022년 8월 25일
1 개 추천
Hi,
MATLAB Coder supports growing an array only by concatenation, growing an array by index is not supported. Please see: https://in.mathworks.com/help/coder/ug/limitations-with-variable-size-support-for-code-generation.html
Also if you would like to optimize the MEX runtime, you can try disabling IntegrityChecks and ResponsivenessChecks in the MEX coder config.
댓글 수: 3
Chiluveru
2023년 2월 13일
Size mismatch (size [1 x 0] ~= size [16 x 0]).
geeting this error can you help me in sloving this please
Chiluveru
2023년 2월 13일
need help to solve the above error
Walter Roberson
2023년 2월 13일
You are assigning an empty array with 16 rows to a variable that was first assigned an empty array with one row.
When you use MATLAB Function Blocks in Simulink, then unless you use coder.varsize then the first assignment to a variable sets the limits on how large the variable is. This is different from regular MATLAB as regular MATLAB adjusts sizes as needed.
카테고리
도움말 센터 및 File Exchange에서 Kernel Creation from MATLAB Code에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!