Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » is it possible to compile and run Mex file on eclipse
is it possible to compile and run Mex file on eclipse [message #1289609] Wed, 09 April 2014 13:22
hana amiri is currently offline hana amiriFriend
Messages: 1
Registered: April 2014
Junior Member
hello, i want to import Matlab C code generation files and use it in Eclipse as an embedded code (Android NDK).
is it possible to do that?

im not very familiar with C/C++ programming but here's a code from Matlab C file:

#include "rt_nonfinite.h"
#include "test.h"
#include "filter.h"

static emlrtRSInfo h_emlrtRSI = { 182, "filter",
  "C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/datafun/filter.m" };

static emlrtRSInfo i_emlrtRSI = { 42, "eml_xaxpy",
  "C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/eml/blas/eml_xaxpy.m" };

static emlrtRSInfo j_emlrtRSI = { 25, "eml_blas_xaxpy",
  "C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xaxpy.m"
};

static emlrtRSInfo k_emlrtRSI = { 66, "eml_blas_xaxpy",
  "C:/Program Files/MATLAB/R2012b/toolbox/eml/lib/matlab/eml/blas/external/eml_blas_xaxpy.m"
};

/* Function Declarations */
static void eml_xaxpy(real_T a, const real_T x[4001], real_T y[4001]);

/* Function Definitions */
static void eml_xaxpy(real_T a, const real_T x[4001], real_T y[4001])
{
  int32_T n;
  int32_T incx;
  int32_T incy;
  emlrtPushRtStackR2012b(&i_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPushRtStackR2012b(&j_emlrtRSI, emlrtRootTLSGlobal);
  n = 4001;
  incx = 1;
  incy = 1;
  emlrtPushRtStackR2012b(&k_emlrtRSI, emlrtRootTLSGlobal);
  daxpy32(&n, &a, &x[0], &incx, &y[0], &incy);
  emlrtPopRtStackR2012b(&k_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&j_emlrtRSI, emlrtRootTLSGlobal);
  emlrtPopRtStackR2012b(&i_emlrtRSI, emlrtRootTLSGlobal);
}

void filter(const real_T b[4001], const real_T x[4001], real_T y[4001])
{
  real_T dbuffer[4001];
  int32_T j;
  int32_T k;
  memset(&dbuffer[1], 0, 4000U * sizeof(real_T));
  for (j = 0; j < 4001; j++) {
    for (k = 0; k < 4000; k++) {
      dbuffer[k] = dbuffer[k + 1];
    }

    dbuffer[4000] = 0.0;
    if (x[j] == 0.0) {
      for (k = 0; k < 4001; k++) {
        dbuffer[k] += x[j] * b[k];
      }
    } else {
      emlrtPushRtStackR2012b(&h_emlrtRSI, emlrtRootTLSGlobal);
      eml_xaxpy(x[j], b, dbuffer);
      emlrtPopRtStackR2012b(&h_emlrtRSI, emlrtRootTLSGlobal);
    }

    y[j] = dbuffer[0];
  }
}



thank you.
Previous Topic:How to extend CDT to parse comments and to show new elements in project explorer.
Next Topic:"Insert spaces for tabs" does not work!
Goto Forum:
  


Current Time: Fri Mar 29 04:39:07 GMT 2024

Powered by FUDForum. Page generated in 0.02269 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top