473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

use of mxArray in C#

Hi all

I give you here some example code how to make it possible to use the type
mxArray (from matlab) in c and c++. mxArray is defined in matlab.h and
matlab.hpp. To use mxArray in c or c++ you need to include this h-file..and
maybe some libraries also.
My question is: How can I use mxArray in C#??

(If it is this easy in c and c++ there must be a way out in c# also..)

---------------------------------------------------
#include "mat.h"
#include "matlab.h"

#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmatlb.lib")
#pragma comment(lib, "libmmfile.lib")

void main(int argc, char **argv)
{
mxArray *pa;
....

--------------------------------------------------
#include "matlab.hpp" //Interface of MATLAB CPP Math Library

//Add C++ Math Library to project
#pragma comment(lib, "libmatpm.lib")
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmatlb.lib")
#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmmfile.lib")
#pragma comment(lib, "libmatpm.lib")
....
----------------------------------------------------
Nov 16 '05 #1
1 5768
Hi,

I think you should post this question in a Matlab newsgroup. The following
reference : www.pinvoke.net can be helpfull.

Regards,
Bart

--
http://www.xenopz.com
"snowflake" <sn*******@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
Hi all

I give you here some example code how to make it possible to use the type
mxArray (from matlab) in c and c++. mxArray is defined in matlab.h and
matlab.hpp. To use mxArray in c or c++ you need to include this
h-file..and
maybe some libraries also.
My question is: How can I use mxArray in C#??

(If it is this easy in c and c++ there must be a way out in c# also..)

---------------------------------------------------
#include "mat.h"
#include "matlab.h"

#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmatlb.lib")
#pragma comment(lib, "libmmfile.lib")

void main(int argc, char **argv)
{
mxArray *pa;
...

--------------------------------------------------
#include "matlab.hpp" //Interface of MATLAB CPP Math Library

//Add C++ Math Library to project
#pragma comment(lib, "libmatpm.lib")
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmatlb.lib")
#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmmfile.lib")
#pragma comment(lib, "libmatpm.lib")
...
----------------------------------------------------

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ronny | last post by:
Can anyone tell me why the following code works fine using an array. <snip> double xVal; // array mxArray *X = NULL; //MatLab mxArrays
13
by: Martijn van den Branden | last post by:
Hi, sorry if this message gets posted twice, i seem to have some problem posting to newsgroups. i've rewritten some loop in matlab using the mex interface method in c, and i've achieved a...
1
by: snowflake | last post by:
Hi I am including a dll-file into my c#-project. This dll-file is c-code that is written in Matlab. In Matlab they use the type mxArray. I need to call a Matlab method that has a mxArray as...
6
by: an0011 | last post by:
Hi static double *var = (double*) malloc(100000*sizeof(double)); is used among other memory allocations to store data that comes from a ..mat file The declarations are done on the main .cpp...
152
by: vippstar | last post by:
The subject might be misleading. Regardless, is this code valid: #include <stdio.h> void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); } int main(void) { double array = { {...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.