passing data to compiled C++ code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • runcyclexcski@yahoo.com

    #1

    passing data to compiled C++ code

    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.

  • Stuart Redmann

    #2
    Re: passing data to compiled C++ code

    runcyclexcski@y ahoo.com 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.publi c.vc.language.

    Regards,
    Stuart

    Comment

    • anon

      #3
      Re: passing data to compiled C++ code

      runcyclexcski@y ahoo.com 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

      Comment

      • Default User

        #4
        Re: passing data to compiled C++ code

        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

        Comment

        Working...