Julia for MATLAB Users

Julia for MATLAB Users
A Free Online Reference

Introduction

edit

This Wikibook is a place to capture information that could be helpful for people interested in migrating code from MATLAB™ to Julia, and also those who are familiar with MATLAB and would like to learn Julia. It is meant to supplement existing resources, for instance the noteworthy differences from other languages page from the Julia manual. However this wiki intends to be more comprehensive, and to be structured in such a way as to make it easy for one to find answers to questions like:

  • For a given MATLAB or MATLAB toolbox command/function/construct what are the closest Julia equivalents?
  • For a given MATLAB toolbox, what Julia packages provide similar functionality?

All of the content here is geared towards someone with a MATLAB background. In general this book assumes that the reader is well acquainted with the fundamentals of MATLAB and any aspects of that product that they are interested in seeing the Julia equivalent(s) for. This book is not intended to be a resource for learning MATLAB! In contrast, we do not assume any knowledge of Julia, but leave general purpose introductions to the language to other resources (see Related Resources below for some of these).

There are also tools to access Julia from MATLAB.[1]

Contents

edit

The book contains distinct sections offering readers different ways to approach learning how to use Julia from the point of view of a MATLAB user.

This part provides a guided tour of Julia intended to orient a typical MATLAB user to some of the most significant aspects of Julia, emphasizing what might be some of the more unexpected differences and also highlighting some of the areas where Julia has particular strengths relative to MATLAB.

This part includes short tutorials that walk MATLAB users through some typical example scenarios, each demonstrating how some particular workflow or idiom from MATLAB would translate to Julia.

The organization of this part of the book mirrors that of the MathWorks' on-line documentation; that is, the core MATLAB language features are together in the MATLAB section which when complete would map everything found in the core MATLAB documentation to Julia equivalents, while another section on the Control System Toolbox, for instance, would map functionality documented in its toolbox documentation page to Julia equivalents.

Applicable Versions

edit

The most recent MATLAB documentation (currently R2020a[2]) is assumed unless otherwise specified.

In general when equivalent Julia 1.0 (i.e. 0.7 without deprecation warnings) functionality exists this is what will be linked to, but in cases where this does not exist but an earlier version, e.g. 0.6, has the functionality the latter may be linked to. A more recent version of Julia like Julia 1.5.1 might be advised.

edit

Julia

edit

Julia and MATLAB

edit

Contributing

edit

Contributions are encouraged! See the WikiBooks Help:Contributing page. In particular here are some notes on contributions to this book.

Style

edit

Of course, follow the Wikibooks Manual of Style. In addition, specific to this book the following style conventions apply.

MATLAB and Julia command/function names

edit

Command and function names in either language when written inline should be in code text format. In addition in the individual command/function name sections the MATLAB command/function names should link to an appropriate page in the MATLAB documentation and similarly for the Julia equivalent where it is first mentioned on that page. For example, see the entry for ans.

edit

In general the intent is to capture the information itself in this wiki, for the same reasons as this is encouraged on Stack Overflow:

Provide context for links

Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.[3]

As such, it is assumed that the main Julia documentation isn't at risk of going offline, but the salient points from other sources should in general be included in this wiki so it is largely self-contained (and thus is itself suitable for offline use). Of course, attribution by means of links to sources of information is highly encouraged.

  1. https://discourse.julialang.org/t/ann-juliafrommatlab-jl-call-julia-from-matlab/66882
  2. Only the most recent MATLAB documentation is available on the MathWorks' website without a login; previous releases' documentation is accessible with but only with a login (though creating one appears not to require a MATLAB license).
  3. https://stackoverflow.com/help/how-to-answer