I'm not exactly sure what's going on in there with all those indices but I think I may be able to offer an alternative. Check out the third paragraph of the documentation, here, for return value information. I suggest using a cell array for clarity.
function main()
workingDir = 'E:\MASTERS\MatLAB\FullVideo_R_OF_HOF\Images';
S4A = zeros(360,640,3,256);
%getting 256 frames of the images
for ii = 1:256
A{ii} = imread(fullfile(workingDir,'S4A',strcat('(',int2str(ii),').png')));
end
%showing first frame only
imshow(A{1});
end