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?!

```
Ask questions about his expertise and experience in applying [MATLAB](http://en.wikipedia.org/wiki/MATLAB) in your domain.

Ask questions about how he would approach designing an application for implementation in MATLAB. If he refers to recent features of MATLAB, ask him to explain them, and how they are different from the older features they replace or supplement, and why they are preferable (or not).

Ask questions about his expertise with MATLAB data structures. Many of the MATLAB 'experts' I've come across are very good at writing code, but very poor at determining what are the best data structures for the job in hand. This is often a direct consequence of their being domain experts who've picked up MATLAB rather than having been trained in computerism. The result is often good code which has to compensate for the wrong data structures.

Ask questions about his experience, if any, with other languages/systems and invite him to expand upon his observations about the relative strengths and weaknesses of MATLAB.

Ask for top tips on optimising MATLAB programs. Expect the answers: vectorisation, pre-allocation, clearing unused variables, etc.

Ask about his familiarity with the MATLAB profiler, debugger and [lint](http://en.wikipedia.org/wiki/Lint_%28software%29) tools. I've recently discovered that the MATLAB 'expert' over in the corner here had never, in 10 years using the tool, found the profiler.

That should get you started.