From: Fraser Dickson on
Hi,

I need help coding up a function as a C MEX file i have been looking at the help files but i really dont get it.
My function has the following inputs all as INTs

a,b,cr,kr,cd,kd

and temp_array as a 500*128 array

The function has one output out which again is a 500*128 array



for x = 1:a
x_under_test = x +kr+cr;
for doppler = 1 : b
y_under_test = y+kd+cd;

r4_r3_r2_r1 = temp_array(y_under_test-cd-kd : y_under_test +cd +kd , x_under_test-cr-kr:x_under_test+cr+kr);

r4mean = mean2(r4_r3_r2_r1(1:kd,kr+cr+1+cr:kr+cr+cr+kr));
r3mean = mean2(r4_r3_r2_r1(1:kd,1:kr));
r2mean = mean2(r4_r3_r2_r1(kd+cd+1+cd:kd+cd+cd+kd,kr+cr+1+cr:kr+cr+cr+kr));
r1mean = mean2(r4_r3_r2_r1(kd+cd+1+cd:kd+cd+cd+kd,1:kr));

ave_upper = (r1mean+r2mean)/2;
ave_lower = (r3mean+r4mean)/2;

out(y,x) = max(ave_upper,ave_lower);

end
end



Can anyone help me convert this to a mex file




Thanks
From: Jan Simon on
Dear Fraser!

> I need help coding up a function as a C MEX file i have been looking at the help files but i really dont get it.

Please describe, *what* you do not get. If you need general information about Mex files, look into the example files shipped with Matlab.
If you need help with the algorithm, you should define what "mean2" is.

So please post, what you've tried so far and where the problems appeared.

Kind regards, Jan
 | 
Pages: 1
Prev: Analog-to-Digital
Next: image to data conversion