Developer Zone

Advanced Software Development with MATLAB

Operationalizing MATLAB 5

Posted by Arvind Hosagrahara,

Operationalizing MATLAB

In this post, I'll describe how to operationalize MATLAB. By "operationalize" I mean taking MATLAB used for its modeling, analytics, statistics or application development capabilities and making it available to a targeted set of users (internal or external).

First let's consider the big picture. There are many ways to tackle operationalization but not all approaches are suitable for all applications. Everything that you read here is documented but across different product documentation sets. With this post, I've gathered what you'll need to consider.

The power of your MATLAB implementation can be leveraged across a variety of platforms and here, I'll attempt to lay out the available options which range from simple push-button methods to more involved/powerful strategies.

Our first use-case is aimed at developers who are building analytics and models for MATLAB users. Here our target audience is users who sit in front of a MATLAB session.

Packaged MATLAB Apps and Toolboxes

MATLAB apps are self-contained MATLAB programs with UI front-ends that automate a task or calculation. These apps can be created with the App Designer (an environment for building apps), GUIDE (GUI development environment) or, for greater control over design and development, programmatically in MATLAB code.

The apps are then packaged into a .mlappinstall standalone file for easy distribution to our target MATLAB users. Double clicking the file will install the application and make MATLAB functionality available.

Similarly, an entire toolbox of functionality can be packaged into a MATLAB toolbox (.mltlbx) using the Add-ons functionality in MATLAB.

Once packaged, the MATLAB app or toolbox can be versioned and managed like any other file. Users can employ a variety of tools to suit their needs. I know of users accomplishing this with something as simple as a shared folder or as complex as complete ecosystems of enterprise apps managed via SharePoint, Git, etc.

MATLAB Engine based approaches If your target user is using C/C++, Fortran, Java or Python and would like to leverage the power of MATLAB analytics in their application, then the MATLAB Engine API is one potential approach. This allows their programs to connect to a MATLAB session via the engine API and invoke their MATLAB analytics.

This is a peer-to-peer connection and the user's environment will need to reconcile the ramifications of such an interface. It is useful in automation of tasks and in applications where MATLAB is an equally privileged, equipotent participant in the application.

MATLAB Runtime powered approaches The MATLAB Runtime is a standalone set of shared libraries that enables the execution of compiled MATLAB applications or components on computers that do not have MATLAB installed.

The Application Deployment products leverage the MATLAB Runtime to allow MATLAB developers to share their work royalty-free with people who don't have access to MATLAB.

In this space, the solutions range from standalone desktop applications and Microsoft Excel add-ins to full integration with enterprise IT systems.

The waters run a bit deep here - so, to further break down the use-cases for this, it makes sense to approach the possibilities from the perspective of whether the target user would like to decentralize the application with the MATLAB Runtime and application installed per user or centralize the analytics using a client-server approach.

For decentralized approaches, MATLAB can be made available as standalone application or a Microsoft Excel add-in using the MATLAB Compiler. For custom applications in C/C++, .NET, Java and Python, the MATLAB Compiler SDK provides platform specific shared libraries, Microsoft .NET assemblies, Java classes and Python Packages from MATLAB programs.

For a centralized approach, the MATLAB Compiler SDK provides the flexibility to develop your own custom infrastructure or take advantage of MATLAB Production Server for secure, scalable web and enterprise applications.

To aid in these integrations, the MATLAB Production Server supplies lightweight client libraries for C/C++, .NET, Java and Python as well as simple clientless RESTful JSON-powered interfaces - providing a full product stack with capabilities for synchronous and asynchronous execution of MATLAB code like we discussed on this blog earlier.

MATLAB Coder based approaches There are several environments where a full MATLAB session as well as the MATLAB runtime environment is not suitable. These platforms (such as 32-bit environments) are often at the core of data appliances and embedded environments. Fortunately, MATLAB Coder furnishes workflows to generate standalone readable and portable C and C++ code from your MATLAB code.

This brings me to my favorite trick question: on a typical day, when do you first use operationalized MATLAB?

Most people answer that it would be after getting their coffee and clicking on the familiar membrane at work. In reality operationalized MATLAB is probably at work as you insert the key into your car for your drive to the office or earlier when you pick up your electric toothbrush or when you wake up, turn on the lightswitch and light up your day.

MathWorks tools allow you to combine these different use cases, described here, to meet your particular needs. If required, these products can be coupled with Training and Consulting services to help with the implementation of solutions to your engineering problems.

MathWorks' website has several videos and articles that consider deployment strategies. I recommend this video about Application Deployment and this newsletter article.

I've tried to condense this information and survey it from the viewpoint of a developer (i.e. you, the reader). In doing so, I arrived at the following treasure map / cheat sheet / infographic / decision tree of possible routes. While neither perfect nor complete - I wanted to share the perspective.

What do you think of it? Please use the comments and let me know.

And finally, are you looking to operationalize Simulink models, or improve performance by parallelizing using Parallel Computing Toolbox and the MATLAB Distributed Computing Server?

Were you curious about how it fits here?

Please do indicate interest in the comments since those are completely different topics that I have been considering blogging about in the future.


Get the MATLAB code

Published with MATLAB® R2016b

5 CommentsOldest to Newest

David Barry replied on : 1 of 5

Nice post that highlights the nontrivial landscape. Does MATLAB Mobile not deserve a mention here? I look forward to the day where your diagram has boxes for “Do you need to run your app in a web browser” or “Do you need to run your app on iOS device”. Push button deployment to those environments would be the icing on the cake.

Arvind Hosagrahara replied on : 2 of 5

You are absolutely right. The decision tree is neither perfect nor complete and MATLAB Mobile offers one among several ways to address operationalization of MATLAB on mobile / non-desktop environments. That topic is perhaps worthy a post of its own in the future.

The decision tree appears non-trivial since there are so many diverse approaches that address different use cases. As they say – with power comes responsibility and having the palette of technology choices allows one to address this diversity.

Aditya Shah replied on : 3 of 5

Very interesting – lots of different options for sure.

I don’t see a mention of Simulink (and other related toolboxes) here… is it implied once a connection to Matlab is established? I can foresee applications related to deploying simulations to targeted users, especially as model-based design becomes more prevalent.

Arvind Hosagrahara replied on : 5 of 5

Aditya, you raise a good point. I intentionally stayed clear of bringing Simulink into the picture since the topic of using deployed MATLAB applications with deployed Simulink models is a topic that deserves a post all by itself.

We have a publicly available whitepaper that describes the architecture and design of such a real-world system that you may be interested in. It was published at the SAE COMVEC and is available at:
https://www.mathworks.com/company/newsletters/articles/cummins-vehicle-mission-simulation-tool-software-architecture-and-applications.html

Add A Comment

Your email address will not be published. Required fields are marked *

What is 8 + 9 ?

Preview: hide