Your comments

Thanks, that made sense and it works like a charm now.

Thanks again for impressively quick replies and fixes.

Hi, it works fine now.

When I use a parfor-loop instead of a for-loop the accuracy is (some times) reduced to quad precision (the same thing occurs when I am using the symbolic toolbox with the vpa() function). When I tried to create a minimal working example, I failed to reproduce the phenomena (my code is quite large). I guess I could investigate this in detail to find the problem, but this issue might be known to you?

Jon Vegard