passing data to compiled C++ code

R

runcyclexcski

I have written an image processing app in Matlab which works fine
when
I analyse images one at a time, but is very slow when I have to
analyze thousands of images in a row. So I re-wrote the image
analysis
routine in C++, compiled in .NET. The C++ code runs about 20 times
faster than Matlab. Being a layman in programming, I am now wondering
how to make matlab talk to C++.

The C++ code is a .cpp file and an .h file. The .cpp file contains ~5
functions that talk to each other, and the main() produces the final
result. From what I understand to make a .dll I can export functions
one at a time - is that so? If yes, how can I make main () .dll talk
to the .dlls with the seconday functions and then report to matlab?
Or
do I have to bundle all functionalities into the main()?

I forgot to add that the arguments to be passed from matlab to the C+
+
code are two matrices of data type short, about 512 by 512 (two
pointers in C++ notation), and the data returned are also two
matrices of data type float or double.
 
S

Stuart Redmann

I have written an image processing app in Matlab which works fine
when
I analyse images one at a time, but is very slow when I have to
analyze thousands of images in a row. So I re-wrote the image
analysis
routine in C++, compiled in .NET. The C++ code runs about 20 times
faster than Matlab. Being a layman in programming, I am now wondering
how to make matlab talk to C++.

The C++ code is a .cpp file and an .h file. The .cpp file contains ~5
functions that talk to each other, and the main() produces the final
result. From what I understand to make a .dll I can export functions
one at a time - is that so? If yes, how can I make main () .dll talk
to the .dlls with the seconday functions and then report to matlab?
Or
do I have to bundle all functionalities into the main()?

I forgot to add that the arguments to be passed from matlab to the C+
+
code are two matrices of data type short, about 512 by 512 (two
pointers in C++ notation), and the data returned are also two
matrices of data type float or double.

Please don't multi-post. If it can be avoided, cross-post instead (and don't
forget to set up a follow-up tag).

I posted my answer to microsoft.public.vc.language.

Regards,
Stuart
 
A

anon

I have written an image processing app in Matlab which works fine
when
I analyse images one at a time, but is very slow when I have to
analyze thousands of images in a row. So I re-wrote the image
analysis
routine in C++, compiled in .NET. The C++ code runs about 20 times
faster than Matlab. Being a layman in programming, I am now wondering
how to make matlab talk to C++.

The C++ code is a .cpp file and an .h file. The .cpp file contains ~5
functions that talk to each other, and the main() produces the final
result. From what I understand to make a .dll I can export functions
one at a time - is that so? If yes, how can I make main () .dll talk
to the .dlls with the seconday functions and then report to matlab?
Or
do I have to bundle all functionalities into the main()?

I forgot to add that the arguments to be passed from matlab to the C+
+
code are two matrices of data type short, about 512 by 512 (two
pointers in C++ notation), and the data returned are also two
matrices of data type float or double.

I did this 6 years ago, but unfortunately I completely forgot how. I
remember that the code in c++ has to have a wrapper. We used a 3rd party
library for that.

Anyway, this has nothing to do with standard c++.

Why dont you search the net? Most likely matlab's site
 
D

Default User

Stuart Redmann wrote:

Please don't multi-post. If it can be avoided, cross-post instead
(and don't forget to set up a follow-up tag).

This is horrible advice. Do NOT cross-post with follow-up. What do you
expect, people in one or more groups to subscribe to one they don't
currently follow just to keep up with the thread? That makes no sense.

If the message was legitimate for cross-posting (and there are very
few) then the thread should continue in all groups.

The only reasonably use of cross and follow-up is when you are
redirecting a message that is not appropriate for a particular group.
Then it is reasonable to cross-post to the correct group and set
follow-ups to that one.





Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top