problem with interfacing C# , C and MatlabDear Friends,
I am performing the following steps
1 compiling a set of m files along with openCV dlls using the mcc to create a dll. The compilation is done using Visual Studio 2008 on a 32 bit PC.
2 I have a C# application that send data to the .C file generated by matlab.
3 This data is then sent to my matlab application( the generated dlls). on this pls
4 The compilation and generation of the dlls is done on a 32 bit machine using 32 bit matlab.
5 When I run this application on a 64 bit machine it does not run. My collegues say that ,i am sending an integer data to the Matlab from C program. In the 64 bit machine i will need to convert it into a string or maybe a long long int. can anyone shed some light.
Pls tell me if there is any info i am overlooking pls
Regards,
LFG
"LFG Tech" wrote in message <iqh1qk$53m$1@newscl01ah.mathworks.com>...
> Dear Friends,
>
> I am performing the following steps
> 1 compiling a set of m files along with openCV dlls using the mcc to create a dll. The compilation is done using Visual Studio 2008 on a 32 bit PC.
>
> 2 I have a C# application that send data to the .C file generated by matlab.
>
> 3 This data is then sent to my matlab application( the generated dlls). on this pls
>
> 4 The compilation and generation of the dlls is done on a 32 bit machine using 32 bit matlab.
>
> 5 When I run this application on a 64 bit machine it does not run. My collegues say that ,i am se...
Interfacing Matlab (C-shared) Library and C#Hi,
I wish to use a c-shared library in a managed code environment, c#.
For testing, I created a c-shared library, matlab_test.dll, using deploytool.
This library contains only one function, 'matlab_test(test_string)' which
accepts a string as a parameter.
I'm using DllImport to create calls to unmanaged code:
/// <summary>
/// Initiate the matlab environment
/// Matlab changed the interface without updating the documentation!
/// _proxy must be added, for no apparent reason?
/// Result: Hours wasted on matlab model. Thanx matlab-guys..
/// </summary>
/// <returns>True if successfull, false otherwise</returns>
[DllImport("mclmcrrt710.dll", EntryPoint = "mclInitializeApplication_proxy")]
static extern bool InitiateMatlabApplication(string options, Int32 count);
/// <summary>
/// Terminate the matlab environment
/// Matlab changed the interface without updating the documentation!
/// _proxy must be added, for no apparent reason?
/// Result: Hours wasted on matlab model. Thanx matlab-guys..
/// </summary>
/// <returns>True if successfull, false otherwise</returns>
[DllImport("mclmcrrt710.dll", EntryPoint = "mclTerminateApplication_proxy")]
static extern bool TerminateMatlabApplication();
/// <summary>
/// Create string t...
C#/C++ interface to a running MATLAB sessionI want to transfer data to the RUNNING MATLAB application. Here I see two options:
1. Use CreateObject("Matlab.Application") to create new session and use this session.
However I did not figure out how to launch not Engine but complete set of MATLAB workspace windows.
2. Connect to the existing MATLAB workspace engine. Not clear how.
Can somebody help me ?
Boris
...
More about C and C++Hello,
I have wrote:
>I will resume it like this:
>On the criterias of "complexity" and "difficulty", the C and C++
>programming languages are more complex and difficult than Object
>Pascal for example, so since they are more complex and difficult they
>are likely to create something like a darwinian filter who don't let
>the weaker humans among us humans to cross or to climb the social
>ladder, this is why i think that C and C++ do participate to social
>darwinism, this is why i say that C and C++ are bad.
Joseph Mitzen repsonded:
>Something may be more complex or more difficult to learn but it may
>bring more capabilities. For instance, a helicopter is both
>mechanically more complex and more difficult to learn to fly than an
>airplane. However, helicopters possess vertical takeoff and landing
>which allow it to reach places planes can not and also gives it
>special abilities, such as hovering.
>Two important measurements then are the value (what one gains for the
>complexity) and what one needs to do (is language X enough for the
>task, will feature Y be used, etc.).
>Otherwise, one could simply say "Delphi is more complex and difficult
>than Ruby or Python, therefore Delphi is bad." It's not only
>simplistic, it's also meaningless (bad at what?).
I understand your example of hellicopter, you are s...
Exporting data from C++ to Matlab --> using pointers in c++ instead of...If i have:
//option 1 - it doesn't work
float *nou;
nou = (float *) calloc(50, sizeof(float));
//option 2 - it works
float nou[15];
How can I send "nou" to Matlab if it's a pointer (option 1)??? -
option 2 works with the code:
I'm using this code:
mxArray *TxNou = NULL;
TxNou = mxCreateNumericMatrix(1, 15, mxSINGLE_CLASS, mxREAL);
memcpy((void *)mxGetPr(TxNou), (void *)nou, sizeof(nou));
matlab.PutVariable("TxNou", TxNou);
matlab.EvalString("plot(TxNou);");
I don't know what changes I have to do in the code - i've tried a lot
of things... i don't find the error!
Thanks for your advice,
Oscar
Oscar Esteve wrote:
> If i have:
> //option 1 - it doesn't work
> float *nou;
> nou = (float *) calloc(50, sizeof(float));
> //option 2 - it works
> float nou[15];
>
> How can I send "nou" to Matlab if it's a pointer (option 1)??? -
> option 2 works with the code:
>
> I'm using this code:
> mxArray *TxNou = NULL;
> TxNou = mxCreateNumericMatrix(1, 15, mxSINGLE_CLASS, mxREAL);
> memcpy((void *)mxGetPr(TxNou), (void *)nou, sizeof(nou));
Why not use mxGetData and avoid the cast?
in option 1:
sizeof(nou) = sizeof(float *) = 4 on 32 bit, 8 on 64bit.
In option 2:
sizeof(nou) = 15*sizeof(float) = 15*4 = 60
> matlab.PutVariable("TxNou", TxNou);
> matlab.EvalString("plot(TxNou);");
>
> I don'...
Call to Matlab functions from C/C++I need call to matlab fminsearch function from a c/c++ program. Has matlab a c++ library available?
Thanks
"Alain" <alainc@euskalnet.net> wrote in message <hkoshv$145$1@fred.mathworks.com>...
> I need call to matlab fminsearch function from a c/c++ program. Has matlab a c++ library available?
>
> Thanks
See the C/C++ MATLAB external interface doc.
http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/bqoqnz0.html
James Tursa
...
Shall i use the misrosoft Visual c++ code from a m-file generated from matlab in Visual C++ with out matlab runtime environmentundefined
...
US-MA-Natick: Developer, C++, C, XML, Java, MATLAB, Simulink, CAD tools; C-P (45307257608)US-MA-Natick: Developer, C++, C, XML, Java, MATLAB, Simulink, CAD tools; C-P (45307257608)
==========================================================================================
Position: Developer
Reference: SMC01487
Location: Natick MA
Duration: C-P
Skills: 3+yrs of software engineering with strong C++, C, XML, and Java
programming skills.
Experience with MATLAB and Simulink.
Knowledge in simulation algorithms and engineering systems.
Experience with engineering simulation and CAD tools
Please send your current resume in confidence to <staffing@eurosoft-inc.com>
..45307257608.
...
histrogram in matlab using c or c++ codehi
i am looking for a c or c++ code in matlab for creating a histogram of a grayscale image.
thanks
"shaizy" wrote in message <j56br3$3dp$1@newscl01ah.mathworks.com>...
> hi
> i am looking for a c or c++ code in matlab for creating a histogram of a grayscale image.
>
> thanks
If you have the Image Processing Toolbox, see imhist.
I'm not sure I understand what you mean by you are looking for C or C++ code in MATLAB.
Wayne
...
Audio compression with matlab vs c/c++ ?Hi
1. what are the advantages of develop audio compression (G711/729/...) in MATLAB instead of develop it in C/C++ ?
2. I saw a lot of implementations of audio compression in C/C++ and not in MATLAB , Is there a reason ?
>
> 1. what are the advantages of develop audio compression (G711/729/...) in MATLAB instead of develop it in C/C++ ?
Development speed.
>
> 2. I saw a lot of implementations of audio compression in C/C++ and not in MATLAB , Is there a reason ?
Running speed, and portability.
Bruno
Hi
when you mention development speed and running speed, you mean that in Matlab it is faster than C/C++ ?
Can you explain why ?
"amit liron" wrote in message <jg14qu$g11$1@newscl01ah.mathworks.com>...
> Hi
>
> when you mention development speed and running speed, you mean that in Matlab it is faster than C/C++ ?
No, the opposite. I answered in the right order the two questions.
> Can you explain why ?
Bruno
Thank's again
the last Q :-)
why and when should I use matlab ?
"amit liron" wrote in message <jg1ge6$is9$1@newscl01ah.mathworks.com>...
> Thank's again
>
> the last Q :-)
> why and when should I use matlab ?
All depend on your skill of both languages.
For me, all the time, until I'm sure about the algorithm will work, then implement it in C/C++ if I need speed.
Bruno
...
Convert C/C++ struct to matlab structHi all
I have two applications the first is written in c language and the other in matlab language, they are both communicateby using tcp.
Application 1(c language) send struct data to application 2(matlab language).
How can i make matlab recognize the received data as a struct data?
For example :
C code
myfile.h
struct My_struct1
{
int x;
int y[10];
};
struct My_struct2
{
char x1;
char y1[10];
float x2;
float y2[10];
double x3;
double y3[10];
My_struct1 z;
};
I am sending My_struct2 from c to matlab.
This is the matlab code
Objtcp = tcpip('10.1.4.23');
set(Objtcp, 'RemotePort', 55555)
fopen(Objtcp)
if (get(Objtcp, 'BytesAvailable') > 0)
[Receivedata len] = fread(Objtcp, Objtcp.BytesAvailable);
% Now the Receivedata is 'double' type
end
I want to convert/cast the Receivedata that will be My_struct2 type
Thx
"zohar " <zohar.research@gmail.com> wrote in message <j32a4r$m8k$1@newscl01ah.mathworks.com>...
> Hi all
>
> I have two applications the first is written in c language and the other in matlab language, they are both communicateby using tcp.
>
> Application 1(c language) send struct data to application 2(matlab language).
> How can i make matlab recognize the received data as a struct data?
>
> For example :
> C code
>
> myfile.h
> struct My_struct1
> {
> int x;
&g...
QR Decomp RLSHello,
Anyone know where I might find this?
Michael.
Hi Michael
Simon Haykins Book "Adaptive Filter Theory" comes with qrdrls matlab
code on the CD.
regards
alain
M. Wirtzfeld wrote:
> Hello,
>
> Anyone know where I might find this?
>
>
> Michael.
>
>
...
libmx.dll not consistent, calling matlab from C/C++I have been trying to call matlab from c/c++ with libeng.lib. I have gotten the program to compile and link but when I try to run it, I get the following error message: The procedure entry point mxIsMexLogical cannot be located in the dynamic link library libmx.dll."
So, I downloaded a new copy of libmx.dll from http://www.dlldll.com/libmx.dll_download.html and it worked fine. But when I started Matlab from the windows start menu I get the error messge: "The procedure entry point ?get_dimensions@mxArray_tag@@QEBAPEB_KXZ cannot be located in the dynamic link library libmx.dll."
So I need to keep switching between the dll's everytime I want to switch between calling matlab from C/C++ and activating windows from the start menu.
I am using 2008b and get same error with 2008a.
Does anyone have a solution?
Thanks.
...
C++ BOOKS The C Book / C++ Annotations/ Thinking in C++/ How to Think Like a Computer Scientist C++ Version-The C Book=20
by Mike Banahan, Declan Brady and Mark Doran is an introduction to C for ex=
perienced programmers. The print edition, first published in 1991, is no lo=
nger in print.=20
DOWNLOAD http://hitfile.net/JcVZ
-C++ Annotations
is a free e-book by Frank B. Brokken of the University of Groningen. He use=
s it as the primary text of his course on C++, and it's written for program=
mers already familiar with C
DOWNLOAD http://hitfile.net/CEGU
-How to Think Like a Computer Scientist C++ Version
is the C++ "port" of Allen B. Downey's classic introduction to programming.=
The Python version has been used by MIT for its introduction to programmin=
g. It assumes no prior programming experience.
There are also versions in Python and Java, and a Ruby version is in progre=
ss
DOWNLOAD http://hitfile.net/Q67V
-Thinking in C++
by Bruce Eckel aims to "move you, a little at a time, from understanding C =
to the point where the C++ mindset becomes your native tongue." It's writte=
n with the expectation that the learner have existing knowledge of C syntax=
.. It begins by introducing object oriented programming and moves into cover=
ing more advanced C++ over the course of two volumes
DOWNLOAD http://hitfile.net/Q7tz
...
C++ BOOKS The C Book / C++ Annotations/ Thinking in C++/ How to Think Like a Computer Scientist C++ Version-The C Book=20
by Mike Banahan, Declan Brady and Mark Doran is an introduction to C for ex=
perienced programmers. The print edition, first published in 1991, is no lo=
nger in print.=20
DOWNLOAD http://hitfile.net/JcVZ
-C++ Annotations
is a free e-book by Frank B. Brokken of the University of Groningen. He use=
s it as the primary text of his course on C++, and it's written for program=
mers already familiar with C
DOWNLOAD http://hitfile.net/CEGU
-How to Think Like a Computer Scientist C++ Version
is the C++ "port" of Allen B. Downey's classic introduction to programming.=
The Python version has been used by MIT for its introduction to programmin=
g. It assumes no prior programming experience.
There are also versions in Python and Java, and a Ruby version is in progre=
ss
DOWNLOAD http://hitfile.net/Q67V
-Thinking in C++
by Bruce Eckel aims to "move you, a little at a time, from understanding C =
to the point where the C++ mindset becomes your native tongue." It's writte=
n with the expectation that the learner have existing knowledge of C syntax=
.. It begins by introducing object oriented programming and moves into cover=
ing more advanced C++ over the course of two volumes
DOWNLOAD http://hitfile.net/Q7tz
...
help with using C/C++ library generated by Matlab CoderI am new in Matlab Coder. I need some help with using the C/C++ static library generated by Matlab Coder. Here is my question. If I have a simple Matlab function that produces a single return number. For example, the coderand function from the User Guide.
function r=coderand() %#codegen
r=rand();
After conversion using Matlab Coder, a C library is generated. In coderand.h, the C function is declared as
extern real_T coderand(void);
And the call of this function from a C program is straightforward.
Now I have another function that takes two input parameters and generates a double matrix:
function r=randmatrix(m, n) %#codegen
r=rand(m,n);
After conversion, the C function declared in the randmatrix.h is as the following:
extern void randmatrix(real_T m, real_T n, emxArray_real_T *r);
The output matrix r becomes a pointer tucked in the input parameter list. How do I call this function from a C program and get the matrix of random numbers? I can't find a demo that shows me how to do it. Your help will be greatly appreciated.
L.L.
...
Sending data to MATLAB from C/C++ code running in the backgroundHello,
I'd like to run a purpose-designed C/C++ program at the same time a MATLAB script is running and have MATLAB receive data (in my case, numbers) from the program in a streaming fashion. For example, say the C program (I'm going to write C instead of C/C++ from now on) continually recalculates 8 numbers over and over again: the usage of the program in conjunction with the MATLAB script would ideally be something like this:
1. The MATLAB script is started.
2. The C program is started by the MATLAB code (e.g. through a console command). Once the C program initializes, it continually calculates and recalculates 8 numbers in an endless loop until stopped manually by the user.
3. The MATLAB script continues executing until it reaches a point where it requires the 3 numbers from the C program. What I'd like at this stage is for the MATLAB script to be able to acquire the values of the 8 numbers that were most recently output by the C program. This would occur multiple times, so the C program would essentially be streaming the 3 values to MATLAB constantly, with the MATLAB script choosing when to sample them.
Unfortunately, the nature of the C program is such that it takes a few seconds to initialize and so transforming it into a MEX file to be called repeatedly by the MATLAB script would not work (the response wouldn't be fast enough since the initialization delay would occur every time the program was run).
As such, how might I go about getting the C pro...
compiling matlab .m / generating .c (c code) from .mHi everyone,
When I compile a matlab .m file (with mcc command), I get an
executable, that works well, and it also generates a C code (2 .c
files), and some other files (a .ctf, some .m files that do not have
matlab codes, but non readable codes, and others).
As I want to integrate the program with a C project, I don't want it
to be a black box, that I cant' debug. I tried to compile the .c files
in an external compiler, and it did not work. I tried in DevC++ and
also in Microsoft Visual C++. They show errors like "unexpected end of
file while looking for precompiled header directive", and I don't know
exactly what is missing. I was suspecting of #include "mclmcr.h", on
the .c files. I found some suggestions to change that to #include
"mclmcrrt.h", but it did not work. I found a mclmcr.h on the Matlab
folders, but it has other includes that I haven't found.
- Does anyone know if that .c files are usable or are only some
intermediate step while Matlab is building that exe?
- If I need those .h, how can I get them?
- Do I need to use that other files (other than those .c) generated
while compiling?
- If I am in the wrong way, what's the best way to get C files from .m
files?
Thank you in advance.
renatoab <barbosarenato@gmail.com> wrote in message <0276d457-a463-42a9-86b5-ad3abfc9c351@z10g2000yqb.googlegroups.com>...
> Hi everyone,
>
> When I compile a matlab .m file (with mcc command), I get an
> exe...
QR Decomp RLSHello,
Anyone know where I might find this?
Michael.
...
C++ to C compilerHi all.
I've made a tool which compiles a C++-like language and produces good
old C99 (with some gcc extensions in certain cases). Maybe it can get
in the free-compilers list.
It is interesting because by studing the -readable- generated C code
you an understand how C++ features are implemented. It's also easy to
add new features and extensions.
The URL is:
http://students.ceid.upatras.gr/~sxanth/lwc/index.html
It is only known to work on a gcc/gnu-libc system and it is
definitelly BETA. The parser is written entirely in C.
I'm currently working on a builtin regular expression compiler which
produces C code for compile-time regular expressions (faster than
perl- more efficient than scanf in the simple ones).
Stelios
...
Interaction between C and C++Hello,
I'm writing a code library which must have a C interface. Since I can see
many advantages by using STL over making your own linked lists I thought I
would make a test to see if I could get it working.
The test consist of 2 parts: a C++ file which has C interface and a plain C
file which calls the functions offered.
The code is listed below.
Even though it seems to work I am not convinced that it's safe. As a example
C doesn't have constructors or destructors. In the example the vector<int>
constructor needs to be called and similar for the destructor. So when the
constructor/destructor gets called depends on when the objects gets in and
out of scope which C wouldn't know anything about. My theory is that the
linker has something additional to do such as call the constuctor when the
object is about to be called. I verified that my theory was right by
disassembling the resulting object code from the example code and saw that
there is a public symbol created with the name _CRT$XCU which code calls the
destructor. So it seems that CRT comes into play.
Can any of you tell me how this works? Would it be safe for distribution?
My tests were done with MS VC++ but is it safe to assume that other
compilers under other OS's such as gcc would work similarly?
Thanks,
-- John
File listing:
lib.cpp:
----------------
#include "lib.h"
#include <vector>
using namespace std;
vector<int> g_IntVector;
void AddInt(int nVal)
{
g_Int...
c/c++ required?i'm interested in learning java because i want to move on from perl and php
and general web applications like that. i read somewhere that, to learn
java, knowing C and C++ is required.
any feedback on that?
- jesse
jesse wrote:
> i'm interested in learning java because i want to move on from perl and php
> and general web applications like that. i read somewhere that, to learn
> java, knowing C and C++ is required.
>
> any feedback on that?
>
> - jesse
>
>
http://java.sun.com/docs/books/tutorial/index.html
> i'm interested in learning java because i want to move on from perl and
php
> and general web applications like that. i read somewhere that, to learn
> java, knowing C and C++ is required.
it is really better if you _don't_ know c and c++ before you start with
java.
____________
http://reader.imagero.com the best java image reader.
jesse wrote:
> i'm interested in learning java because i want to move on from perl and php
> and general web applications like that. i read somewhere that, to learn
> java, knowing C and C++ is required.
>
> any feedback on that?
>
> - jesse
I wouldn't go so far as to say REQUIRED. It can certainly help if you
know C syntax as Java is almost indistinguishable from that (within
methods, of course). And if you've got a sound basis in Object-Oriented
programming from C++ then you're more than halfway there. That's a big
IF, BTW. Estim...
google trends on java,c#,perl,c++,chttp://google.com/trends?q=java%2Cc%23%2Cperl%2Cc%2B%2B%2Cc&ctab=0&date=all&geo=all
Java and C show big.
Perl, C++, C# show small.
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
...
C / C++ skillsHi,
I can write assembly, however i have limited knowledge on C / C++.
Is a high level of knowledge in this langauge necessary to program
microcontrollers ??
Or can you just use more "simple" commands ?
russellseres@gmail.com wrote:
> Hi,
> I can write assembly, however i have limited knowledge on C / C++.
> Is a high level of knowledge in this langauge necessary to program
> microcontrollers ??
> Or can you just use more "simple" commands ?
I guess you don't know assembly very well then. Anything you can do in
C/C++ you can do in assembly. However, you will be much more productive
using C/C++ so I'd recommend you learn C.
On 11 Aug 2006 17:41:30 -0700, "russellseres@gmail.com"
<russellseres@gmail.com> wrote in comp.arch.embedded:
> Hi,
> I can write assembly, however i have limited knowledge on C / C++.
> Is a high level of knowledge in this langauge necessary to program
> microcontrollers ??
> Or can you just use more "simple" commands ?
I never heard of "assembly". Did you mean for one particular
processor? Did you think there was only one? There are literally
thousands.
Almost certainly, the one assembly language that you do know will not
work on any microcontroller, so at the very least you will need one
new assembly language if you don't want to program in C.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http...