Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: m-code and c++_mex code conversion
Replies: 2   Last Post: Aug 7, 2013 9:14 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kate

Posts: 90
Registered: 8/28/10
m-code and c++_mex code conversion
Posted: Aug 7, 2013 3:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 MEX-version of it. Any help in getting a working MEX-script appreciated, -thanks.

Matlab function is at :
http://textuploader.com/?p=6&id=SScXF

Mex-attempt 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)



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.