Wednesday, October 13, 2010

Writing Example Code in Matlab

I came across a Matlab syntax that’s very useful in embedding example code inside the function.

% Example:

%{

Code to run the example here

%}

Notice that a user just need to copy the example code and paste into Matlab, as is, instead of having to do the select text, Ctrl+T, Ctrl+C, and then Ctrl+R sequence to uncomment and copy the code.

Reference: MATLAB Central – File detail – Learning the Unscented Kalman Filter [Matlab Central]