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

```
Possible question:
I have an array A of n R,G,B triplets. It is a 3xn matrix. I have another array B in the form 1xn which stores an index value (association to a cluster) for each triplet.

How do I plot the triplets of A in 3D space (using `plot3` function), coloring each triplet according to its index in B? (The goal is to qualitatively evaluate my clustering)

Really, really good programmers who are MATLAB novices won't be able to give you an efficient (== MATLAB style) solution. However, it is a very simple problem if you do know your MATLAB.