Hi Ceren
As per the error message shared by you it suggests to me that 'mssim' was not assigned a value when 'ssim_index' function is used.
I can suggest one workaround just based on the above information:
If you are not specifically tied to a custom ssim_index function, MATLAB's built-in ssim function is recommended for calculating the Structural Similarity Index. You can replace your ssim_index call with ssim like below:
[mssim, ssim_map] = ssim(images_orig{im}, images{im});
The ssim function returns the mean SSIM value (mssim) and the SSIM map (ssim_map) for the two images. Ensure that both images are of the same size and type. If they are not, you may need to resize or convert them before calling ssim.
For more information on ssim you can refer here: