Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I. I think <a href="https://stackoverflow.com/questions/2435018/two-arrays-defining-2d-coordinates-as-array-indices-in-matlab-octave">this recent SO question</a> on indexing is a very good question for an "expert".</p> <blockquote> <p>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:</p> <pre><code>for i=1:nx for j=1:ny output(i,j) = A(ix(i,j),iy(i,j)); end end </code></pre> <p>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).</p> </blockquote> <p>II. Basic knowledge of operators like element-wise multiplication between two matrices (<code>.*</code>).</p> <p>III. Logical indexing - generate a random symmetric matrix with values from <code>0-1</code> and set all values above <code>T</code> to 0.</p> <p>IV. Read a file with some properly formatted data into a matrix (<code>importdata</code>)</p> <p>V. Here's <a href="https://stackoverflow.com/questions/2425066/matlab-comparing-all-elements-in-three-arrays">another sweet SO question</a></p> <blockquote> <p>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.</p> <p>For example:</p> <pre><code>a=[2,4,6,8,12] b=[1,3,5,9,10] c=[3,5,8,11,15] </code></pre> <p>I want to know if there are same values in different arrays (in this case there are 3,5,8)</p> </blockquote> <p><strong>Btw</strong>, there's an excellent chance your interviewee will Google "MATLAB interview questions" and see this post :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload