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: 
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.
I. I think [this recent SO question](https://stackoverflow.com/questions/2435018/two-arrays-defining-2d-coordinates-as-array-indices-in-matlab-octave)
 on indexing is a very good question
 for an "expert".

> 
> I have a 2D array, call it 'A'. I have
>  two other 2D arrays, call them 'ix'
>  and 'iy'. I would like to create an
>  output array whose elements are the
>  elements of A at the index pairs
>  provided by x\_idx and y\_idx. I can do
>  this with a loop as follows:
> 
> 
> 
> ```
> for i=1:nx
>      for j=1:ny
>          output(i,j) = A(ix(i,j),iy(i,j));
>      end 
> end
> 
> ```
> 
> How can I do this without the loop? If
>  I do output = A(ix,iy), I get the
>  value of A over the whole range of
>  (ix)X(iy).
> 
> 
> 

II. Basic knowledge of operators like element-wise multiplication between two matrices (`.*`).

III. Logical indexing - generate a random symmetric matrix with values from `0-1` and set all values above `T` to 0.

IV. Read a file with some properly formatted data into a matrix (`importdata`)

V. Here's [another sweet SO question](https://stackoverflow.com/questions/2425066/matlab-comparing-all-elements-in-three-arrays)

> 
> I have three 1-d arrays where elements
>  are some values and I want to compare
>  every element in one array to all
>  elements in other two.
> 
> 
> For example:
> 
> 
> 
> ```
> a=[2,4,6,8,12]
> b=[1,3,5,9,10]
> c=[3,5,8,11,15]
> 
> ```
> 
> I want to know if there are same
>  values in different arrays (in this
>  case there are 3,5,8)
> 
> 
> 

**Btw**, there's an excellent chance your interviewee will Google "MATLAB interview questions" and see this post :)