Wednesday, April 18, 2012

Get Machinename in Matlab

I'm using a script that sends a tweet every once in a while, and I needed to localize this msg with the host machine name, so I can know from where it comes from.

The host name can be reached by:

if ispc
machinename = getenv('COMPUTERNAME');
machinename = getenv('HOSTNAME');

Tuesday, April 17, 2012

Using warning messages, turning them on or off

Today I discovered a very cool feature of the command "warning" in matlab.

First, everywhere where you have a warning msg, you can use an Identifier for this warning. For example:

warning('Battery:SOC','this is not logical - Warning')

At the beging of the script or even outside the function, you can use

warning off Battery:SOC
As simple as that, you won't see the warnings anymore and you don't need to change your code.

Linked Plots

The following video shows how data can be linked to plots, so that if you change the data (variable in workspace), the plot will be updated automatically.

See the video tutorial here: