Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Accessing OPC-based Matlab Files (.slx)
Forum Updated to NodeBB v4.3 + New Features

Accessing OPC-based Matlab Files (.slx)

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.5k 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.
  • ModelTechM Offline
    ModelTechM Offline
    ModelTech
    wrote on last edited by
    #1

    I need to produce a Matlab (SimEvents) compatible file (extension is .slx), which uses the OPC standard. I found this library on github: https://github.com/dbzhang800/QtOfficeOpenXml which I could perhaps build on to create access to .slx files. Using Qt5.7, I found a small issue but could bypass the compile error. Anyway, I would still need to create the whole .slx structure etc but perhaps there is somebody out there who has already done this. If so, I would like to hear from you.

    JKSHJ 1 Reply Last reply
    0
    • ModelTechM ModelTech

      I need to produce a Matlab (SimEvents) compatible file (extension is .slx), which uses the OPC standard. I found this library on github: https://github.com/dbzhang800/QtOfficeOpenXml which I could perhaps build on to create access to .slx files. Using Qt5.7, I found a small issue but could bypass the compile error. Anyway, I would still need to create the whole .slx structure etc but perhaps there is somebody out there who has already done this. If so, I would like to hear from you.

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by JKSH
      #2

      @ModelTech QtOfficeOpenXml is for office documents (e.g. reports, spreadsheets, etc.); these are quite different to MATLAB Simulink files.

      I suggest you ask around the MathWorks forums for a C/C++ library or API that can read/write .slx files.

      Alternatively, you could start by studying the contents of existing .slx files. They are actually .zip files, so you can extract their contents using any Zip decompressor (e.g. 7-Zip).

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      3
      • ModelTechM Offline
        ModelTechM Offline
        ModelTech
        wrote on last edited by
        #3

        I am aware of these aspects and already did a first study of the content of example .slx files and .mlx files I have. I am basically considering to extend the QtOfficeOpenXml library to deal with these Matlab file types, which are in essence following a similar OPC-based structure so I would expect this is a viable route. Or do you know of a better alternative?

        1 Reply Last reply
        0
        • ModelTechM Offline
          ModelTechM Offline
          ModelTech
          wrote on last edited by ModelTech
          #4

          It turns out that my approach is feasible. After half a day of coding, I am able to create empty model files in .slx format using the OPC part of the referred library. I just need to parameterize a few things in this library to make sure that the [Content_Types].xml file is correct as it currently uses one hard-coded Office default that Matlab does differently. This concerns the core properties and there is a Part that Matlab creates in the Package that is not listen in the [Content_Types].xml file (which seems not 100% conform the standard).

          Edit: After a bit of hacking, I was able to fix all things MathWorks seems to do differently than the standard. Solution is not very nice but works for now. Next step is to generate non-empty model files.

          JKSHJ 1 Reply Last reply
          4
          • ModelTechM ModelTech

            It turns out that my approach is feasible. After half a day of coding, I am able to create empty model files in .slx format using the OPC part of the referred library. I just need to parameterize a few things in this library to make sure that the [Content_Types].xml file is correct as it currently uses one hard-coded Office default that Matlab does differently. This concerns the core properties and there is a Part that Matlab creates in the Package that is not listen in the [Content_Types].xml file (which seems not 100% conform the standard).

            Edit: After a bit of hacking, I was able to fix all things MathWorks seems to do differently than the standard. Solution is not very nice but works for now. Next step is to generate non-empty model files.

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            @ModelTech Thanks for sharing your update! It sounds like you're making good progress with building on top of QtOfficeOpenXml.

            I can't think of any better alternative, except to ask around and see if someone else has already made a library that reads/writes .slx files. (I did a quick Google but didn't find any, so your path might be the best)

            All the best.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • ModelTechM Offline
              ModelTechM Offline
              ModelTech
              wrote on last edited by ModelTech
              #6

              After about one day of programming, I now generate some first partial models from my tool. This is how a model looks in my tool:

              MPEG4 SP Decoder Model in DataFlow Modeller

              And this is how it looks like in DiffPlug, a free Matlab Simulink model viewer:

              MPEG4 SP Decoder Model in DiffPlug

              Today, I also gained access to Matlab Simulink and the same model also opens in Matlab although with a few warnings (generated Matlab Simulink model is still far from complete). Resolving one of these warnings will require an extra small hack in the QtOfficeOpenXML library, but the approach works. So, problem solved (still have a linking issue for QtOfficeOpenXML on windows but hope to solve that later)

              1 Reply Last reply
              3
              • ModelTechM Offline
                ModelTechM Offline
                ModelTech
                wrote on last edited by
                #7

                For those who are interested, this is how the same example currently looks in Simulink

                MPEG4_SP in Simulink

                1 Reply Last reply
                1
                • M Offline
                  M Offline
                  MrShawn
                  wrote on last edited by
                  #8

                  Well, nice work. In my opinion as far as the model goes, I think your tool looks best!

                  1 Reply Last reply
                  1

                  • Login

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