________          ___       __   ________  ________  ___  __            ___  ________           ________  ________  ________  ________  ________  _______   ________   ________      
|\   __  \        |\  \     |\  \|\   __  \|\   __  \|\  \|\  \         |\  \|\   ___  \        |\   __  \|\   __  \|\   __  \|\   ____\|\   __  \|\  ___ \ |\   ____\ |\   ____\     
\ \  \|\  \       \ \  \    \ \  \ \  \|\  \ \  \|\  \ \  \/  /|_       \ \  \ \  \\ \  \       \ \  \|\  \ \  \|\  \ \  \|\  \ \  \___|\ \  \|\  \ \   __/|\ \  \___|_\ \  \___|_    
 \ \   __  \       \ \  \  __\ \  \ \  \\\  \ \   _  _\ \   ___  \       \ \  \ \  \\ \  \       \ \   ____\ \   _  _\ \  \\\  \ \  \  __\ \   _  _\ \  \_|/_\ \_____  \\ \_____  \   
  \ \  \ \  \       \ \  \|\__\_\  \ \  \\\  \ \  \\  \\ \  \\ \  \       \ \  \ \  \\ \  \       \ \  \___|\ \  \\  \\ \  \\\  \ \  \|\  \ \  \\  \\ \  \_|\ \|____|\  \\|____|\  \  
   \ \__\ \__\       \ \____________\ \_______\ \__\\ _\\ \__\\ \__\       \ \__\ \__\\ \__\       \ \__\    \ \__\\ _\\ \_______\ \_______\ \__\\ _\\ \_______\____\_\  \ ____\_\  \ 
    \|__|\|__|        \|____________|\|_______|\|__|\|__|\|__| \|__|        \|__|\|__| \|__|        \|__|     \|__|\|__|\|_______|\|_______|\|__|\|__|\|_______|\_________\\_________\
                                                                                                                                                               \|_________\|_________|
________          ___       __   ________  ________  ___  __            ___  ________      
|\   __  \        |\  \     |\  \|\   __  \|\   __  \|\  \|\  \         |\  \|\   ___  \    
\ \  \|\  \       \ \  \    \ \  \ \  \|\  \ \  \|\  \ \  \/  /|_       \ \  \ \  \\ \  \   
 \ \   __  \       \ \  \  __\ \  \ \  \\\  \ \   _  _\ \   ___  \       \ \  \ \  \\ \  \  
  \ \  \ \  \       \ \  \|\__\_\  \ \  \\\  \ \  \\  \\ \  \\ \  \       \ \  \ \  \\ \  \ 
   \ \__\ \__\       \ \____________\ \_______\ \__\\ _\\ \__\\ \__\       \ \__\ \__\\ \__\
    \|__|\|__|        \|____________|\|_______|\|__|\|__|\|__| \|__|        \|__|\|__| \|__|
                                                                                            
                                                                                            
                                                                                            
           ________  ________  ________  ________  ________  _______   ________   ________      
          |\   __  \|\   __  \|\   __  \|\   ____\|\   __  \|\  ___ \ |\   ____\ |\   ____\     
          \ \  \|\  \ \  \|\  \ \  \|\  \ \  \___|\ \  \|\  \ \   __/|\ \  \___|_\ \  \___|_    
           \ \   ____\ \   _  _\ \  \\\  \ \  \  __\ \   _  _\ \  \_|/_\ \_____  \\ \_____  \   
            \ \  \___|\ \  \\  \\ \  \\\  \ \  \|\  \ \  \\  \\ \  \_|\ \|____|\  \\|____|\  \  
             \ \__\    \ \__\\ _\\ \_______\ \_______\ \__\\ _\\ \_______\____\_\  \ ____\_\  \ 
              \|__|     \|__|\|__|\|_______|\|_______|\|__|\|__|\|_______|\_________\\_________\
                                                                         \|_________\|_________|

Matlab Live Script Keyboard Shortcuts

Keys

Action

Ctrl Alt L

Insert Title (#)

Ctrl Alt H

Insert Heading (##)

Ctrl Alt Enter

Insert Section Break (%%)

Ctrl I

Italic

Ctrl B

Bold

Ctrl U

Underline

Ctrl M

Monospaced

Ctrl K

Hyperlink

Ctrl Alt G

Latex/Equation

Ctrl Alt Enter

Toggle Code/Text Mode

Title, Heading and Section Break can be triggered without the shortcut by typing #, ## and %% respectively.


Fixing the MEvent. CASE! error in MATLAB

This rather annoying issue in MATLAB causes the string MEvent. CASE! to be repeatedly printed to the command window every time you scroll any window in the application. The suggested solution is to run

!synclient HorizTwoFingerScroll=0

as part of your startup file to disable horizontal scrolling. This however does not work on more recent linux versions because the synaptics touchpad driver is being deprecated in favour of libinput. The new solution to this problem is slightly more complex however.


Tips for MATLAB on Linux

Setting up MATLAB can be a hassle. On Linux systems some of the defaults settings can be rather baffling. Here are the first things I do after installing.

Install the matlab-support package

After installing MATLAB you may be frustrated to find that it doesn’t appear in the launcher. To run it you need to open a terminal and manually run the matlab command. On Ubuntu-derived systems the matlab-support packages solves this. It creates the missing .desktop files to let the launcher know about MATLAB and offers to solve some common problems with MATLAB on Linux. Pi To install it …


Virtual Reference Feedback Tuning

Virtual Reference Feedback Tuning is a data driven method used to design a controller for an unknown plant based on input/output measurements. The method uses a single set of input/output data generated by the plant without the need for specific experiments or model identification.


Open In File Browser for Linux

On windows when right clicking in the file browser pane you can select Open in file browser to open the current folder in windows explorer. On linux you will simply get an error message stating that this action is not supported on this operating system (as of MATLAB 2016a).


Quickly changing projects in MATLAB

When working on several different projects in MATLAB changing from one project folder to another can be a hassle. Some projects are in a shared dropbox folders, others are in my main MATLAB directory. Most powerful text editors offer a way of quickly changing project directories without having to navigate the folder structure by hand.


Quick Tip: Receive a pushbullet notification when a ssh login is successful

Pushbullet is a service that allows you to push notifications to your devices. We will be using it to send us a notification any-time somebody successfully connects to our server with ssh.

The cleanest way to run a script when on ssh logins is through PAM. PAM or “Pluggable Authentication Module” is a library called by all the authentication related functions in Linux that provides a way to hook into the authentication process.


Exporting MATLAB figures to LaTeX

The standard way of exporting figures from MATLAB to LaTeX is to use the builtin print command to export the figure to an eps file using:

print -depsc $filename

Unfortunately figures exported this way generally do not look like the original MATLAB figures. The aspect ratio is different and the fonts are too small. This can be overcome by tweaking the paper size, the font size and the line thickness but the process is fiddly and resulting eps files are hard to use since alternative TeX compilers like XeTeX and LuaTeX do not support eps files out of the box.