Well I assume that you want to convert the envelope of the coloured region into a single RGB-tripplet. In your particular case I'd simply try to determine the coordinates of the curve, let's call it I(lambda). Then I'd get the corresponding RGB-values, just above the wavelength-axis, that would give us the RGB-values at each wavelength, in an [n_lambda x 3] array. The total contributions to the R, G and B channels would then be the sum of the product of the respective intensities. You might have to scale those to be between 0 and 1 (or 0 and 255) for display-purposes.
RGB = double(squeeze(IM(idx_xaxis+1,:,:)));
Rtot = sum(I_of_lambda(:).*RGB(:,1));
Gtot = sum(I_of_lambda(:).*RGB(:,2));
Btot = sum(I_of_lambda(:).*RGB(:,3));
Then repeat procedure for second curve.