Stuart’s MATLAB Videos

Watch and Learn

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the Original version of the page.

Using a List of Anonymous Functions to Implement a Set of Checks on a Data Set

Posted by Stuart McGarrity,

I need to perform a number of checks on the values in a large table. Currently I implement the checks in code in a script. I find it can be cumbersome if I want enable or disable certain checks, as I need to comment out or use a if/then. Looking at my checks, they appear all to be of a similar structure: element-wise operations on the columns of the table. So I thought I would try to implement the checks as a list of anonymous functions stored in a spreadsheet. This way I could easily enable/disable with a column value. I get stuck for a while (between 22:35 and 31:00), where I think isempty operates element-wise on an array when it always operates on the entire array and returns a scalar. Also sound quality is reduced from there to the end. Features covered in this code-along style video include:
  • Anonymous functions
  • regexp, cellfun
Follow me (@stuartmcgarrity) if you want to be notified via Twitter when I post.
Play the video in full screen mode for a better viewing experience.