MATLAB: In an assignment A(:) = B, the number of elements in A and B must be the same. (MxNx3) matrix.

for loopMATLAB

Here is my code, I am simple beginner please help.
filelistL = dir([fileparts('C:\onedrivenewest\OneDrive\Walkways Thesis\stereo lense distortion correction\step 2 disparity map\difference map1.png') filesep '*.PNG']);
fileNamesL = {filelistL.name};
number_of_columsL = size(fileNamesL,2);
for L = 1:number_of_columsL
RSoutput(L) = reconstructScene(im2double(imread(strcat('C:\onedrivenewest\OneDrive\Walkways Thesis\stereo lense distortion correction\step 2 disparity map\', fileNamesL{L}))), stereoParams);
%dlmwrite(strcat('C:\onedrivenewest\OneDrive\Walkways Thesis\stereo lense distortion correction\step 3 create 3d points\3D points storage\', int2str(L), '.txt'), RSoutput)
end
ignore the dlmwrite.

Best Answer

You are attempting to store the entire matrix returned by the reconstruction into a single numeric location . You need to switch to cell arrays.
RSoutput{L} = etc
instead of (L)