Search code examples
arraysimagematlabcell-array

Saving Images in Cell Array (Matlab) into different files


I have a 1x7049 Cell Array. Each of the elements of this array is a 96x96 matrix.

Now, I want to save each of these 96x96 matrices into jpg files, so that I will get 7049 images. How can I do this?


Solution

  • Use a loop

    for ii = 1:numel(myCellArr)
        fileName = sprintf('image_%04d.jpg');
        imwrite( myCellArr{ii}, fileName );
    end