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');
else
machinename = getenv('HOSTNAME');
end

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:
http://www.mathworks.de/videos/matlab/linked-plots-and-data-brushing.html

Tuesday, January 17, 2012

Change Label of a Colorbar in Matlab

Hi there,

Everytime I need this code, I don't know where to look for it. I hope google will find it from my page, and help other users.

The problem is: You need to label the colorbar in a plot, and you don't know how.

Solution:

set(get(h.colorbar,'YLabel'),'String','myLabel')


Leave your comments if you have a better idea.

Thanks

I'm back

Hi there,

after many years of absence, I'm back. I will post again my matlab & Co tricks. Thanks!