Get in touch
Transforming MATLAB Evaluation GUI to Modern Web-GUI
Back to blog
Applications and tools developmentJanuary 8, 2021

Transforming MATLAB Evaluation GUI to Modern Web-GUI

MATLAB, as you all know, is a popular programming language that is extensively used for computationally expensive solutions. MATLAB is best suited for developing image processing algorithms, signal processing algorithms, and GUI (Graphical User Interface) applications, as it has readily available libraries that help in faster development. MATLAB natively supports hardware interfaces (like connecting with Evaluation Modules (EVM)), and it has rich inbuilt plot functions that help in visualizing data as graphs more easily, which in turn makes it a go-to product for developing Evaluation GUIs. 

Evaluation GUIs are similar to other GUIs, but they are mostly used to evaluate semiconductor chips. These GUIs have features centered around visualizing and benchmarking chip performance. Though MATLAB has numerous features, it suffers from the following drawbacks when distributing a MATLAB solution as an installer to end customers:

         1. The UI (User Interface) and UX (User Experience) of the GUI (Graphical User Interface) developed using MATLAB are generally difficult to follow

         2. Since MATLAB is computationally expensive, complex GUI applications built on MATLAB will tend to be slow


To overcome this, we can use web-based applications to develop GUI and MATLAB can be used to process the required data. Web Applications are similar to normal applications except that they run on a web browser instead of the host OS. Web applications can be accessed by anyone with or without an internet connection, depending on the application’s architecture and intended use case. So why a web-based application?

         1. Most of the technologies used in web technology are completely open-source; e., we can edit and redistribute applications built using these technologies free of cost.

        2. There are numerous open-source frameworks and packages available, like Angular and Bootstrap, which can be used to make the look and feel of the GUI better

        3. Rich documentation and large active developer base

        4. The application can be distributed as a standalone GUI application or linked to a webpage, which can be opened anywhere using the Internet

        5. Let’s visually compare the GUI developed using MATLAB and Web Technology 


MATLAB & Web GUI: 

Credits: Mathworks.com (link: https://www.mathworks.com/help/control/ug/build-app-with-interactive-plot-updates.html)  

migrated-6a2b92d7c41cef3e3adf15b9-69.png

 It can be seen that the UI and UX of the Web GUI are more appealing than MATLAB 

How to Integrate MATLAB with web-based GUI applications: 

There are multiple ways to integrate MATLAB with GUI applications such as:

          1. Running MATLAB exe and opening a port for communication through which both applications can exchange information

          2. Converting MATLAB into DLLs and creating a C++ wrapper to call these MATLAB DLLs.

          3. Converting MATLAB into C, C++ DLLs (it seems possible with newer versions)

Among the three possible solutions above, I will be explaining the second solution. 

DLLs (Dynamic Linked Libraries) can be used to establish communication between two different software. They contain functions, classes, variables, and resources (such as icons, images, files, etc.) that an EXE or other DLL uses. In Windows, these files are represented as .dll and .so in the Linux/Unix environment.  

MATLAB natively supports converting the MATLAB source code into DLLs which can be used in other applications. Web-based GUIs are generally built using HTML, CSS, and JavaScript (JS). Node.js is an environment that runs JavaScript code and NPM (Node Package Manager) is a package manager for JavaScript packages. It contains numerous open-source JavaScript packages that help develop solutions faster.  

JavaScript does not natively support linking MATLAB DLLs, but it is possible to link a C++ DLL. There are many NPM packages that can be used for linking DLLs and “node-ffi” is one such package. To link MATLAB DLLs to a web-based application, a C++ wrapper needs to be created. This wrapper can be used to interact with MATLAB functions in the DLL. This wrapper can be converted into DLLs and can be linked to the web-based application. Diagrammatically, the whole process can be represented as: 

migrated-6a2b92d7c41cef3e3adf15b9-70.jpg

There are numerous open-source graph tools available for web applications that can be used to visualize data more intuitively and in a user-friendly way. Combining these, we can create a GUI with improved UI/UX design, process the data using MATLAB functions, and visualize the processed data as a graph.  

The graphs developed can be more intuitive from a UI perspective as well as in terms of user experience. These graphs play a key role in evaluating a chip’s performance using EVM boards in the semiconductor industry.  A better Interface will always have an upper hand in attracting customers.  Thus, it is possible to replace a MATLAB GUI with a web-based application that can be distributed to end-customers.  

One thing to be noted is that the MCR (MATLAB Compiler Runtime) needs to be installed in the target PC (i.e.) the PC where the web-based application runs. MCR is important to run MATLAB DLLs. Though MATLAB is proprietary software, MCR can be installed free of cost. 


Written by

Sreeram Kalyanasundaram

Jan 8, 2021

Have a similiar challenge?

Tell us what you're working on. We'll tell you how we can help.

Talk to a Soliton Engineer