Matlab make matrix from calculation : <p>so i have this code, 
        clc
        data=[1;3;4;3;5;2;5]
        cnt=size(data,1)</p>

<pre><code>    for i=2:cnt;
        im=(data(i)-(data(i-1)))    
    end
    im
</code></pre>

<p>i need a matrix output from that code</p>

<p>but my output still like this</p>

<pre><code>data =

     1
     3
     4
     3
     5
     2
     5


cnt =

     7


im =

     2


im =

     1


im =

    -1


im =

     2


im =

    -3


im =

     3
</code></pre>

<p>how to make this kind of output?</p>

<pre><code>im =

     2
     1
    -1
     2
    -3
     3
</code></pre>

<p>i still confused to got an output like that?</p>
