I am generating C code from Matlab coder. I have a function as follows
function C = foo( A, B ) %#codegen
for j=1:100,
C = C+A(j);
end
end
The code for this function in c generated is
void foo(float A[100],B,float* C){
for(j=0;j<100;j++){
*C+=A[j];
}
}
I want the code to be efficient and generated in the following way:
void foo(float* A,B,float* C){
//here B is the length of the array
for(j=0;j<B;j++){
*C+=*(A+j);
}
}
Do you have an idea?