passing data to compiled C++ code

Discussion in 'C++' started by runcyclexcski@yahoo.com, Oct 26, 2007.

  1. Guest

    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.
    , Oct 26, 2007
    #1
    1. Advertising

  2. wrote:
    > 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
    Stuart Redmann, Oct 26, 2007
    #2
    1. Advertising

  3. anon Guest

    wrote:
    > 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
    anon, Oct 26, 2007
    #3
  4. Default User Guest

    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
    Default User, Oct 26, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Klaus Schneider
    Replies:
    1
    Views:
    528
    Rolf Magnus
    Dec 2, 2004
  2. lander
    Replies:
    5
    Views:
    579
    bruce barker
    Mar 5, 2008
  3. Luca
    Replies:
    0
    Views:
    205
  4. A. Atienza

    Passing code/data from code-behind to ASPX page

    A. Atienza, Dec 8, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    306
    Eliyahu Goldin
    Dec 8, 2004
  5. aratienza

    Passing data/code from code-behind to aspx

    aratienza, Dec 8, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    111
    haile
    Dec 10, 2004
Loading...

Share This Page