Matlab错误“查找需要变量大小” [英] Matlab error "Find requires variable sizing"
问题描述
关于编译失败的行。上面的行是循环的。
x1
, x2
, x3
, x4
是标量(自然数)
ocpRefPt
是一个2x16矩阵
错误:FIND需要变量大小
这是什么意思。如何克服这个错误?
所以你似乎正在尝试编译 emlmex
find
的输出大小是未知的,显然编译器需要固定大小的输出。请参阅此新闻组帖子一个解释。 这种编译方法似乎已经过时 - 使用 MATLAB coder ( codegen
命令):
emlmex
从MATLAB代码生成一个C-MEX文件。
emlmex [-options] fun1 [fun2 ...]
过时。对于通用加速
和代码生成,使用CODEGEN
。
[~,col] = find(ocpRefPt(2,:)>x1 & ocpRefPt(2,:)<x2 & ocpRefPt(1,:)>y1 & ocpRefPt(1,:)<y2);
About is the line where the compilation fails. The above line is in a loop.
x1
,x2
,x3
,x4
are scalars(natural numbers)
ocpRefPt
is a 2x16 matrix
Error: FIND requires variable sizing
What does this mean. How to overcome this error?
So it seems that you are trying to compile with emlmex
to make embedded code. The error is saying that the size of the output of find
is not known, and apparently the compiler requires fixed size outputs. See this newsgroup post for one explanation.
This method of compilation seems to be obsolete -- use the MATLAB coder (codegen
command) instead:
emlmex
Generate a C-MEX file from MATLAB code.emlmex [-options] fun1 [fun2 ...]
This function is obsolete. For general purpose acceleration and code generation use
CODEGEN
.
这篇关于Matlab错误“查找需要变量大小”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!