MATLAB: Auto save figure from frame data-set

autosaveMATLAB

I would like to draw and autosave the surface form frame data-set (151x151x800)
Therefore, here is my question:
Input: frame dataset (151x151x800)
Output: 800 .jpg image
Thank you for your help.
surf(frame(:,:,1)); axis tight; view(0,90); shading interp
.
.
.
surf(frame(:,:,800)); axis tight; view(0,90); shading interp
  • Sample code
image.jpg
  • Sample surface image

Best Answer

Let A be your 151x151x800 data.
[nx,ny,nz] = size(A) ;
for i = 1:nz
pcolor(A(:,:,i)) ;
axis tight
shading interp
saveas(gcf,[num2str(i),'.jpg'])
end