Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. Matlab to c++ in QT
Forum Updated to NodeBB v4.3 + New Features

Matlab to c++ in QT

Scheduled Pinned Locked Moved Unsolved The Lounge
17 Posts 12 Posters 2.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Assaf1990
    wrote on last edited by
    #1

    I have Matlab code and I want to transform this code using Matlab coder to c++ then use it in QT. Can I do this and how?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From a cursory look, use Matlab to generate the library and then use it as any other C++ library.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Assaf1990
        wrote on last edited by
        #3

        @SGaist said in Matlab to c++ in QT:

        use Matlab to generate the library and then use it as any other C++ library.

        thank you
        Is there any example about that?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          About using Matlab's facility to generate C++ ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Assaf1990
            wrote on last edited by
            #5

            Thank you sir
            No, I know to use Matlab to generate c++, but after generating c++ from Matlab, how to call this in QT? is there example about that?
            Is this method effective or not?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Qt is a C++ framework, use your library as you would with any other C++ library.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • B Offline
                B Offline
                Beahan
                wrote on last edited by Beahan
                #7

                I have tried to compile the MATLAB code to a C++ library using the mcc command with the msvc2008 compiler. For my QT C++ code, I'm using mingw to compile. However, when I try to add in the MATLAB converted C++ code there seems to be a lot of problems.

                Upsers

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You can't mix and match C++ libraries from different compilers.

                  That's is also true for different versions of Visual Studio up to VS2017 that was the first to be backward compatible with VS2015y

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2
                  • N Offline
                    N Offline
                    Neal698
                    Banned
                    wrote on last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Chauncey
                      wrote on last edited by Chauncey
                      #10

                      I'm a grad student who's done most of his programming in Matlab and now, due to speed considerations on numerical simulations, have to program in C++.

                      I am familiar with syntax and some level of OOP concepts, but most of my C++ programming so far has been on Linux, where writing (in Vim) and compiling (g++) has never been an issue.

                      MyFordBenefits

                      jsulmJ 1 Reply Last reply
                      0
                      • Kent-DorfmanK Offline
                        Kent-DorfmanK Offline
                        Kent-Dorfman
                        wrote on last edited by
                        #11

                        different systems have different ABI (application binary interface). It's always safest to compile from sourcecode on the target platform. Assuming the same compiler is used to compile the matlab library as the target system you should be able to link in the .o, .a, or .so library file if you have the correct header to describe the interface functions.

                        While matlab is great for non-programmers to do stuff quickly, the matlab c++ output is probably not going to be an optimal c++ object oriented design. Sometimes it is more effective to prove out the algorithm in matlab then hand code it in c++ when porting.

                        1 Reply Last reply
                        0
                        • C Chauncey

                          I'm a grad student who's done most of his programming in Matlab and now, due to speed considerations on numerical simulations, have to program in C++.

                          I am familiar with syntax and some level of OOP concepts, but most of my C++ programming so far has been on Linux, where writing (in Vim) and compiling (g++) has never been an issue.

                          MyFordBenefits

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @Chauncey Do you have a question/problem?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • Y Offline
                            Y Offline
                            Youmin
                            wrote on last edited by
                            #13

                            Hi !

                            I would also like to convert matlab code to c ++ but I have a lot of error with MatLab Coder.... Like using the "tiff" function for example..

                            I therefore think of redoing everything by hand but I wonder if it is possible to access the matlab functions (like "Tiff") in Qt with a library.

                            I think I understood that it was possible to do this but I do not understand how... Is there a general matlab library or should it be created with your project? Is the use of matlab compiler mandatory?

                            I'm new to matlab so I'll ask you to be specific please :)

                            Thank you in advance :)

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              randall8479
                              Banned
                              wrote on last edited by randall8479
                              #14
                              This post is deleted!
                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                Louis35
                                Banned
                                wrote on last edited by Louis35
                                #15
                                This post is deleted!
                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  rahulkunal123
                                  Banned
                                  wrote on last edited by
                                  #16
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • Christian EhrlicherC Offline
                                    Christian EhrlicherC Offline
                                    Christian Ehrlicher
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    Closing this topic - it somehow attracks spammers.

                                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                    Visit the Qt Academy at https://academy.qt.io/catalog

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved