Jump to content
Excelsior Forums
satisharkatala

Need help. I am trying to call MatLab Generated C

Recommended Posts

HI,

Wish you Happy New year.

I looked at all the examples. All I want is to know whether the Matlab generated C program can be called from Java. I am working on some java application where I need to call MatLab-generated Binary codes (DLL). I read some interesting articles on MathForum and came across your web site. Your xFunction is very helpful. I am attaching some C prototypes generated by Matlab engine. I appreciate if you can tell me whether xFunction can support this kind of DLL. I mean there is web application (Java Servlet) that is required to call some complex Computation MatLab code in the form of DLL. Please take a look at the MatLab Generated C Program.

Thanks

Satish Arkatala

This is MatLab generated C program

#ifndef MLF_V2

#define MLF_V2 1

#endif

#include "libmatlb.h"

#include "testzlib.h"

#include "testz.h"

#include "str2num.h"

#include "fliplr.h"

#include "iscell.h"

extern _mex_information _lib_info;

static mexFunctionTableEntry function_table[4]

 = { { "testz", mlxTestz, 2, 1, &_local_function_table_testz },

     { "str2num", mlxStr2num, 1, 2, &_local_function_table_str2num },

     { "fliplr", mlxFliplr, 1, 1, &_local_function_table_fliplr },

     { "iscell", mlxIscell, 1, 1, &_local_function_table_iscell } };

static _mexInitTermTableEntry init_term_table[4]

 = { { InitializeModule_testz, TerminateModule_testz },

     { InitializeModule_str2num, TerminateModule_str2num },

     { InitializeModule_fliplr, TerminateModule_fliplr },

     { InitializeModule_iscell, TerminateModule_iscell } };

static int _reference_count = 0;

_mex_information _lib_info

 = { 1, 4, function_table, 0, NULL, 0, NULL, 4, init_term_table };

void testzlibInitialize(void) {

   mclLibInit("testzlib", &_reference_count, &_lib_info);

}

void testzlibTerminate(void) {

   mclLibTerm("testzlib", &_reference_count, &_lib_info);

}

============================================================================================================================================

This is the actual Matalab program

function z = testz(x,y)

x = str2num(x);

y = str2num(y);

fprintf(1,'x = %d\n',x);

fprintf(1,'y = %d\n',y);

z = x^y;

fprintf(1,'z = %d\n',z);

fid = fopen('test.txt','w');

fprintf(fid,'%d\n',z);

fclose(fid);

 

On Thu, 23 Dec 2004 Excelsior Java Team wrote :

>Hi,

>

>      >>I mean there is web application (Java Servlet) that is required to call some complex

>      >>Computation MatLab code in the form of DLL

>

>You can call the C functions using xFunction API from a Java Servlet. Please, read xFunction Programmer's Guide and check the samples included to use the API.

>

>Regards,

>

>Excelsior Support

:huh:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×