Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Kate
Posts:
90
Registered:
8/28/10


mcode and c++_mex code conversion
Posted:
Aug 7, 2013 3:10 PM


Hello all,
I have a simple Matlab function I want to convert to MEX. But I am having some errors in the MEX code I attempted. Below are links to the working Matlab function & my attempt at coding a MEXversion of it. Any help in getting a working MEXscript appreciated, thanks.
Matlab function is at : http://textuploader.com/?p=6&id=SScXF
Mexattempt verison of original function at: http://textuploader.com/?p=6&id=ugjGM
To run the code, here is a script with data which works with the Matlab function:
clc;clear all;close all beep off format long data1 = [0.020167 0.018696 0.136442 0.027073 0.047748 0.121732 0.022645 0.063994 0.113459 0.025322 0.055569 0.121202 0.025322 0.055569 0.121202
];
data2 = [0.004491 0.004283 0.139417 0.011341 0.077656 0.116881 0.022994 0.050471 0.139951 0.006699 0.018414 0.138197 ];
x1 = data1(:,1); y1 = data1(:,2); z1 = data1(:,3);
x2 = data2(:,1); y2 = data2(:,2); z2 = data2(:,3);
% parameters % sigma_p2 =0.01; sigma_inf = 0.00001; sigma_factor = 0.9; d_02 = 0.01; %%
h_R = [1 0 0 ; 0 1 0 ; 0 0 1]; h_t = [0 0 0]; rowsA = size(x2,1); colsA = size(x1,1); h_one = ones(colsA,1);
h_Xx = x1; h_Xy = y1; h_Xz = z1;
h_X = [h_Xx h_Xy h_Xz];
h_Yx = x2; h_Yy = y2; h_Yz = z2;
h_Y = [h_Yx h_Yy h_Yz];
pitchA = floor(rowsA/4 + 1) *4;
[h_A ]=update_A_testing(h_Xx,h_Xy,h_Xz,h_Yx,h_Yy,h_Yz,colsA,rowsA,h_R,h_t,sigma_p2,pitchA)



