Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

RemoteUse

Determine if Matlab is being used remotely

It can be convenient to have scripts which behave differently if ran locally or remotely.

The most common reason would be not having a display when running remotely, which means not being able to display figures (see below for things to fix if that is the case). In order to tell if there is a matlab GUI, the best way is to check with:

usejava('desktop')

which will return 1 if a desktop is running and 0 otherwise.

Things to change in Matlab:

Figure visibility
set(0,'DefaultFigureVisible','off')
Window docking
set(0,'DefaultWindowStyle','normal')

Handy OS changes

If you expect to work both locally and remotely on a given computer, it can be handy to have a matlab launcher, which launches matlab differently depending on the situation. A simple example with Bash to launch without graphics when logging in remotely:

#!/bin/bash
if [ "$SSH_CONNECTION" ]; then
   echo "Connected remotely, starting Matlab in terminal"
   /opt/matlabR2015a/bin/matlab -nodisplay -nosplash
else
   echo "Local use, starting Matlab Desktop"
   /opt/matlabR2015a/bin/matlab
fi
Edit - History - Print - Recent Changes - Search
Page last modified on September 15, 2015, at 04:31 PM