我从Matlab编码器生成C代码。 我有一个函数,如下所示Matlab高效代码生成
function C = foo(A, B) %#codegen
for j=1:100,
C = C+A(j);
end
end
用于生成此功能在C中的代码
void foo(float A[100],B,float* C){
for(j=0;j<100;j++){
*C+=A[j];
}
}
我想要的代码是有效的,并产生以如下方式:
void foo(float* A,B,float* C){
//here B is the length of the array
for(j=0;j<B;j++){
*C+=*(A+j);
}
}
你有什么想法吗?
我相信你的MATLAB代码会返回错误,因为C变量没有定义。 – yuk 2012-02-09 16:13:31
如何从Matlab生成C代码? – 2012-02-09 18:22:28