For as long as I can remember, one of the most common suggestions for improving performance in MATLAB was to make sure arrays are preallocated. With the advent of the mlint tool, it is spelled out to you in the editor. But what does this mean? What is the best method of preallocating an array? How much difference does it really make? In this post, we aim to find out.
Matlab Recipes From beginner to pro, Matlab Recipes caters for all
The sprintf/fprintf family of functions are more powerful than you know. Even if you think you know what they can do, I bet some functionality has been added since you initially learnt about them. If you have a c-code background and have never read the MATLAB documentation, you may be missing out on some very powerful features like vectorised mode or dynamic precision. This article takes you from beginner to some of the more obscure/advanced features, but features which I think you will find very useful given the correct application.
Hello all, it's been a while, but I'm still here, just been very busy. I'm still working with MATLAB & Simulink, but have also been doing lots of C++ & C# as well. Here's a quick post, to share a technique I worked out, which some may find useful. Whilst working with a multi-rate Simulink model, I wanted a block to run at the fundamental sample rate of the model, i.e. the one you specify in the Solver Settings. What felt like a simple request, proved to be quite tricky.
When you write some MATLAB code, how do you know it is correct and error free? If you edit some existing code, how do you know whether you have broken some pre-existing functionality? The simple answer is TEST it. But nowadays, it's not enough just to try a few values from the command line. With the advent of R2013a, MATLAB now has an automated test suite baked right in to the basic install. Let's explore it using Test Driven Development (TDD)
What I'd like to talk about here are the worst kind of bugs; ones where your code appears to work, or even does work with your test data but will fall over in the field or worse still just gives you slightly the wrong answer. I'll present to you my top 5 most painful MATLAB bugs, which have have all tripped me up over the years, and give you some actionable advice on how to methodically avoid them. They are presented in increasing order of pain, which is roughly equal to frequency*cost_of_bug.
Here is my review of Visual Media Processing Using MATLAB Beginner's Guide, a new book published by Packt and written by George Siogkas.
This article takes you through writing a MATLAB function from the required bare minimum to a fully fledged professional looking function with help text, like a pro would write. It demonstrates how the H1 comment you write becomes integrated into the MATLAB IDE and how comments like See Also automatically produce hyper-linked help pages.