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
QtWS25 Last Chance

Matlab to c++ in QT

Scheduled Pinned Locked Moved Unsolved The Lounge
17 Posts 12 Posters 2.9k Views
  • 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 18 Sept 2020, 17:44 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Sept 2020, 18:10 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 18 Sept 2020, 18:44 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 18 Sept 2020, 18:59 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 19 Sept 2020, 05:01 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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 19 Sept 2020, 15:36 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 13 Mar 2021, 12:26 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
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 13 Mar 2021, 17:14 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 17 Mar 2021, 04:50 last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Chauncey
                      wrote on 27 Apr 2021, 06:03 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

                      J 1 Reply Last reply 27 Apr 2021, 08:06
                      0
                      • K Offline
                        K Offline
                        Kent-Dorfman
                        wrote on 27 Apr 2021, 06:24 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
                          27 Apr 2021, 06:03

                          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

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 27 Apr 2021, 08:06 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 21 May 2021, 09:11 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 13 Jul 2021, 12:00 last edited by randall8479
                              #14
                              This post is deleted!
                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                Louis35
                                Banned
                                wrote on 22 Jul 2021, 09:18 last edited by Louis35
                                #15
                                This post is deleted!
                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  rahulkunal123
                                  Banned
                                  wrote on 18 Jan 2022, 15:29 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 18 Jan 2022, 15:39 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