Question: I programmed in [MATLAB](http://www.mathworks.com/) for many years, but switched to using R exclusively in the past few years so I'm a little out of practice. I'm interviewing a candidate today who describes himself as a MATLAB expert. 

What MATLAB interview questions should I ask?

Some other sites with resources for this:

* ["Matlab interview questions" on Wilmott](http://www.wilmott.com/messageview.cfm?catid=10&threadid=51640)
* ["MATLAB Questions and Answers" on GlobaleGuildLine](http://www.globalguideline.com/interview_questions/Questions.php?sc=MATLAB_Interview_Questions_and_Answers)
* ["Matlab Interview Questions" on CoolInterview](http://www.coolinterview.com/type.asp?iType=453)

Answer: 
This is a bit subjective, but I'll bite... ;)

For someone who is a self-professed MATLAB expert, here are some of the things that I would personally expect them to be able to illustrate in an interview:

* How to use the [arithmetic operators](http://www.mathworks.com/access/helpdesk/help/techdoc/ref/arithmeticoperators.html) for matrix *or* element-wise operations.
* A familiarity with all the basic [data types](http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f2-43934.html) and how to convert effortlessly between them.
* A complete understanding of matrix indexing and assignment, be it logical, linear, or subscripted indexing (basically, everything on [this page of the documentation](http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-85462.html)).
* An ability to [manipulate multi-dimensional arrays](http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-86528.html).
* The understanding and regular usage of optimizations like [preallocation](http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f8-784135.html#f8-793781) and [vectorization](http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f8-784135.html#br8fs0d-1).
* An understanding of how to handle [file I/O](http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f10-61355.html) for a number of different situations.
* A familiarity with [handle graphics](http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f3-15974.html) and all of the [basic plotting capabilities](http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f3-27853.html).
* An intimate knowledge of [the types of functions in MATLAB](http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f4-62416.html), in particular [nested functions](http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f4-39683.html). Specifically, given the following function:

```
function fcnHandle = counter
  value = 0;
  function currentValue = increment
    value = value+1;
    currentValue = value;
  end
  fcnHandle = @increment;
end

```

They should be able to tell you what the contents of the variable `output` will be in the following code, *without* running it in MATLAB:

```
>> f1 = counter();
>> f2 = counter();
>> output = [f1() f1() f2() f1() f2()];  %# WHAT IS IT?!

```
Depends a bit what you want to test. 

To test [MATLAB](http://en.wikipedia.org/wiki/MATLAB) fluency, there are several nice Stack Overflow questions that you could use to test e.g. array manipulations ([example 1](https://stackoverflow.com/questions/1903592/how-can-i-generate-the-following-matrix-in-matlab/1911977#1911977), [example 2](https://stackoverflow.com/questions/1846635/calculate-most-common-values)), or you could use fix-this problems like [this question](https://stackoverflow.com/questions/2462927/matlab-image-corner-coordinates-referncing-to-cell-arrays) (I admit, I'm rather fond of that one), or look into [this list](https://stackoverflow.com/questions/1710299/corner-cases-unexpected-and-unusual-matlab) for some highly MATLAB-specific stuff. If you want to be a bit mean, throw in a question like [this one](https://stackoverflow.com/questions/2142826/mapping-2-vectors-help-to-vectorize), where the best solution is a loop, and the typical MATLAB-way-of-thinking solution would just fill up the memory.

However, it may be more useful to ask more general programming questions that are related to your area of work and see whether they get the problem solved with MATLAB.

For example, since I do image analysis, I may ask them to design a class for loading images of different formats (a MATLAB expert should know how to do OOP, after all, it has been out for two years now), and then ask follow-ups as to how to deal with large images (I want to see a check on how much memory would be used - or maybe they know `memory.m` - and to hear about how MATLAB usually works with doubles), etc.