Loren on the Art of MATLAB

Turn ideas into MATLAB


Loren on the Art of MATLAB has been archived and will not be updated.

Sharing and Running MATLAB Code in the Cloud

There are lots of ways to share MATLAB code. Since there are lots more than there used to be, I thought it would be good to review the state as of July 2021.

Lots of Code, Lots of Places

There are lots of places where you can find shared MATLAB code. My first go-to, after checking that the code I need is not in MATLAB or any of the toolboxes, is to check out the File Exchange.
From here, I can filter further, in this case to find contributions for Earth, Ocean, and Atmospheric Sciences.
And that's not counting more general files on the File Exchange that could be useful for this discipline and its practitioners (Geoscience and Geoscientists here). Also, you can see that some of these contributions aren't simply files, but entire toolboxes, many with a solid history of downloads and high ratings from MATLAB users.

Shared Files

About 5 years ago, we introduced Live Scripts into MATLAB, an interactive notebook environment for exploring data, developing algorithms, publishing reports, and a powerful vehicle for sharing code. You can find these among the shared code documents on the File Exchange, for example, here. I also use live scripts to create and publish posts on The Art of MATLAB blog. You may notice that I often make the scripts available for download.
You can find a gallery of exemplary live script specimens here.

Code Reproducibility and Reuse Sites that Host MATLAB

A number of sites that focus on code reproducibility and reuse host MATLAB on the cloud. Researchers can view and download the MATLAB code for their own use, while publishers, such as Nature, use the sites to conduct peer reviews including running and verifying the code for computation-based papers.
For example, we shared information about Code Ocean a few years ago, showcasing how researchers can upload their code and run code posted by others on Code Ocean without needing to access their own MATLAB license.
CUASHI/Hydroshare, a community for hydrologists, allows easy code reuse and download, such as this live script example that visualizes precipitation using historical rainfall data.
These sites support Open Science with MATLAB since even non-MATLAB users get an opportunity to view, download, reuse, and even run the code themselves. It's particularly potent if the code shared is in the Live Script format; once you are satisfied with the analysis, you can share static PDF, Microsoft® Word, HTML, and LaTeX versions of the files for viewing outside of MATLAB.

Interoperability with Other Languages

People associate Jupyter notebooks with Python but there’s a publicly available kernel for MATLAB too.
Whole Tale supports both a Jupyter Notebook integration and a browser-based MATLAB IDE.
You can also call Python from MATLAB and MATLAB from Python. This direct-call feature is in addition to the long-standing MATLAB support interoperability with other languages such as C, C++, Fortran(!), Java, and more (and many data file formats as well).


Here are a list of additional resources for sharing MATLAB code in a variety of other ways.
MATLAB Drive: Work with your MATLAB files from anywhere, and share them with others.
MATLAB Apps: Interactive MATLAB applications to perform technical computing tasks.
MATLAB Web Apps: Create apps that will run in a web server.
MATLAB Code generation: Generate code from MATLAB programs.


Do you find yourself wanting to share code, but aren't sure how? Are you interested in using MATLAB at any of the existing Science Gateways? Or hoping to have MATLAB hosted on a new gateway? Let us know here.
Copyright 2021 The MathWorks, Inc.

  • print


댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.