Motivation Julia is a very fast language. Julia hybrids many features from many sources. Here I’m taking note on its syntax and features by comparing to Python and Matlab. Basic Functions print is like in python BUT, no \n added at the end of each line. println has the \n String formatting is super easy, we can just use values of expressions. "$greet, $whom.\n" "1 + 2 = $(1 + 2)" Operators . operation extend its usage in matlab it means to vectorize sth. or broadcast one operation to all the element of the argument. This is super powerful, extending beyond arithmatics. You can broadcast everything by putting a . there. ... is like * in python, it could de-bundle a tuple or list into lots of variables. Types :: signify the type of sth. <: signify the type is a subtype of X. nothing equiv to None in python Similar to matlab true false not capitalized. Control Flow Control flow syntax is much like matlab if...elseif...end no indentation or :. Loop syntax is a bit like Python for .... in ..., with some caveat But if there are two things being looped, there needs to be a () , not like python. for (i,x) in enumerate(L) Functions Syntax is like
Oct 15, 2021
Motivation Sometimes, we want to manipulate and interact with our plot in a way that is not built into matlab figure. For example, we would like to visualize images when we are travelling in the hidden space. I requires matlab to visualize things when we click something or slide some bar.
May 16, 2020
Motivation This is one step forward from Data transport between python and matlab, since sometimes you not only want to transport data, but want to share some code in python or matlab. How can we do so?
May 15, 2020
Motivation Common Formats Some formats are really common, so that python and matlab both have standard way to import, read and write. So these can be a common json, yaml Simple python dictionary could be easily dumped in yaml json formats, which record the hierachical structure and can store small amount of array data. The best part is it’s human readable. So it’s really suitable to store short configuration files.
Apr 26, 2020
Motivation Handling parameter and recording them for numerical experiment is a pain in matlab. Solutions Option Parser Input the options as different fields of a structure and parse it through a function, fill in the fields that are missing by checking isfield
Mar 3, 2020
Motivation Matlab and matplotlib in python are plotting packages of daily usage. They share lots of structures but also have minor differences. For beginners using the plotting routines can suffice most daily needs, but for more refined control over layout, fontsize and so on, we need to better understand the object structure in matlab and matplotlib.
Jan 20, 2020
Computer Graphics environment in Matlab @(515.1 Computer Graphics)[matlab] Recently, we are using matlab to do computer vision experiments. Thus this note introduces some function controlling the elementary graphics environment. For Computer Graphics, the basic 3 components are
Nov 14, 2019
Multi-platform Matlab compiling When trying to compile a matlab code, I faced and solved many errors either on the Windows platform and the MacOS platform. Here I note some prominent difference across platform and how to debug the compiling process.
Nov 3, 2019
Just like written languages, different programming languages have different innate styles, which suit different needs. Like Matlab love matrix, love script; python favors tensor, favors subfunction, favors objective-oriented programming; Mathematica are muchly functional; R are better at datatable demonstration.
Sep 10, 2018