powerohit 0 Newbie Poster

Code is :
file = 'foreman.cif';

    clc;
    file = 'foreman.cif';
    nFrame = 10;
    [fid,message]= fopen(file,'rb');
    nRow = 288;
    nColumn = 352;

    img_y = uint8(fread(fid, nRow * nColumn, 'uchar'));


    for k = 1:nFrame
        ImY = reshape(img_y(:,:,k), nRow, nColumn); 
        ImY = ImY';
        imshow(ImY);
        pause(0.5) 
    end

    fclose(fid);
    disp('OK');

The error is :
Error using reshape
To RESHAPE the number of elements must not change.

Error in foremanOne (line 12)
ImY = reshape(img_y(:,:,k), nRow, nColumn);

WHAT MIGHT HAVE GONE WRONG?