Unless you need something special, you should be able to do this with standard syntax for ssim(). Mind you, the SSIM is the mean of the elementwise product of three arrays. If you extract only the index of each component, you're losing information by taking the array means before taking the product. Whether that matters depends what you expect to do with this information.
A = imread('cameraman.tif');
[Sc(1) Scm(:,:,1)] = ssim(B,A,'exponent',[1 0 0]);
[Sc(2) Scm(:,:,2)] = ssim(B,A,'exponent',[0 1 0]);
[Sc(3) Scm(:,:,3)] = ssim(B,A,'exponent',[0 0 1]);
If you need something different, just open ssim(), look at it, and write a version that does what you want.