Saving from inside a parfor loop in Matlab

If you call save from a parfor loop in Matlab, like this for example: parfor k=1:100 foo = exp(-k); save(['myfile',num2str(k),'.mat'],'foo'); endparfor k=1:100 foo = exp(-k); save(['myfile',num2str(k),'.mat'],'foo'); end it will generate an error. I have not exactly figured out why this is but probably it has to do with the fluctuating nature of the foo variable […]

Making function returns in Matlab compact

I used to write this in Matlab: foo1 = zeros(1,100); foo2 = cell(1,100); for i = 1:100 [tmpFoo1, tmpFoo2] = foo ( X ); foo1(i) = tmpFoo1; foo2{i} = tmpFoo2; end foo1 = zeros(1,100); foo2 = cell(1,100); for i = 1:100 [tmpFoo1, tmpFoo2] = foo ( X ); foo1(i) = tmpFoo1; foo2{i} = tmpFoo2; end […]

Understanding the Metropolis Hasting algorithm - A tutorial

The Problem Say you want to evaluate the expectation of a function over a random variable \(E[f(x)] = \int p(x)f(x)dx\), or perhaps find the max of a probability distribution, typically the posterior, \(\arg \max p(x|y)\), where calculating the derivate is intractable since it depends on some feature that comes from some algorithm or some unknown […]

The start-up evangelic

Attended the Stockholm Start-up Day 2013 event. It was really fun and the event was well organized with a good flow. It is great what people are trying to do for Swedish entrepreneurship. Not that there is a lack of really good entrepreneurs in Sweden, but the general mindset of most people is still to get a […]

Friday secrets

"Harry, I’m going to let you in on a little secret. Every day, once a day, give yourself a present. Don’t plan it, don’t wait for it, just let it happen. It could be a new shirt at the men's store, a catnap in your office chair or two cups of good hot black coffee."

What is a Sensory Motor Map - SMM

In robotics one often deal with combining visual input and motor kinematics. A Sensory Motor-Map(SMM) is a map between perception and action such that the robot gets an understanding of how certain motor actions affect the perceived reality. Simply put given some visual input the map gives the kinematics and dynamics to generate the given […]

Two neat LaTex tricks that will make life easier

1. Typesetting modularized LaTex files So you modularized your really long tex file, using includes or input. You find it a bit annoying that every time you change a chapter you have to typeset the main file, you can't just press the typeset button on the chapter file. It turns out that if you just […]

Using cricket connoisseurs and pint drinkers to explain Bayes' Theorem

In a teaching course I am taking I had to do a ten minute talk about anything, but it should be related to my research. The people listening to the talk was a mix of PhD students from different departments at my university. So I had to keep it simple enough so even people with […]

Drag-n-drop latex formulas for keynote

Via onethingwell Latte is a Mac OS X application that uses such Web engines as CodeCogs and Google Chart to typeset formulas written in LaTeX. Formulas can be dragged to other applications (e.g. Keynote, Pages) and, in the case of PDF formulas, scaled to an arbitrary size. Both the LaTeX input and the rendered output can […]

Notes on how to review a paper

One of the first assignments I got when starting my PhD(4 weeks ago) was to review some papers the lab had done, that I would possibly be doing extending work on. As I have never reviewed papers before I thought a good idea would be to go at it like I was reviewing the paper […]