title: 4D matrix calculation, Matlab coding problem
body: <p>hey guys, I got some difficulty here. It is purely coding algorithm problem. Okay, the program is shown below:</p>
  
  <pre><code>for f=1:(nFrames-1)
      h=histogram(imgYuv(:,:,1,f));
      j=histogram(imgYuv(:,:,1,f+1));
      X=abs(h-j)/256; %normalize the difference
      S=sum(X);
  end
  </code></pre>
  
  <p>Basically, I want to calculate the difference between two adjacent elements and store the sum result in an 1-D array <code>S</code>. But the result I got from the above program is one single number. I expected it to be an 1-D array because <code>f</code> is varying from <code>1</code> to <code>nFrames-1</code>. Can anybody help me with this? Thank you!</p>