Matlab Coder : Size Mismatch Issue
36 次查看(过去 30 天)
显示 更早的评论
Hi,
I am using MATLAB coder to generate mex files for the matlab. Here is one error I am getting in line
x2_est_sym = x2_est_sym.';
Size mismatch (size [64 x 1] ~= size [:? x 64]).
The size to the left is the size of the left-hand side of the assignment.
Any idea.
回答(2 个)
Arnab De
2013-4-11
As C is statically typed, MATLAB Coder needs to compute a static type for all variables in the program, which also involves computation of the size. MATLAB Coder sets the size of a variable when it is first used. As the variable x2_est_sym is used in the right hand side and its size at that point is (presumably) [64x1], its size is set to that value. The size of the expression x2_est_sym' is however [:?x64]. When you try to assign it back to x2_est_sym, there is a size mismatch.
It is hard to suggest a fix without looking at more of your code, but can you just use a different variable on the left hand side?
2 个评论
Arnab De
2013-4-19
Hi Harshit, Can you please post a small code snippet that exhibits the behaviour you mentioned, i.e. gives an compiler error that disappears once you use the bracket? Also, please tell me the version of MATLAB you are using. It will be most helpful.
Shubhashree Bal
2018-1-31
编辑:Walter Roberson
2019-12-4
There is a documentation in mathswork that give the answer to this question. The link is attached below:
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!