function a = ComputeAllBinDataR(count2DegAveObs, count12DegAveObs, numberBins)

global 	gB1DataFlag...
		gB2DataFlag...
		gB3DataFlag...
		gB4DataFlag...
		gB5DataFlag...
		gB6DataFlag...
		gC1DataFlag...
		gC2DataFlag...
		gC3DataFlag...
		gB7NPDataFlag...
		gCNPDataFlag;
		
global 	gB1Data...
		gB2Data...
		gB3Data...
		gB4Data...
		gB5Data...
		gB6Data...
		gC1Data...
		gC2Data...
		gC3Data...
		gB7NPData...
		gCNPData;
		
global 	gB1InvStokesM...
	 	gB2InvStokesM...
	 	gB3InvStokesM...
	 	gB4InvStokesM...
	 	gB5InvStokesM...
	 	gB6InvStokesM...
	 	gC1InvStokesM...
	 	gC2InvStokesM...
	 	gC3InvStokesM;
		
global 	gAverageCimelFlag;

	% Compute the average data for the requested bands.
	
if gB1DataFlag == 1
	gB1Data = ComputeBinDataR(...
				gB1Data, gB1InvStokesM, count12DegAveObs, numberBins);
	end;
	
if gB2DataFlag == 1
	gB2Data = ComputeBinDataR(...
				gB2Data, gB2InvStokesM, count12DegAveObs, numberBins);
	end;
	
if gB3DataFlag == 1
	gB3Data = ComputeBinDataR(...
				gB3Data, gB3InvStokesM, count12DegAveObs, numberBins);
	end;
	
if gB4DataFlag == 1
	gB4Data = ComputeBinDataR(...
					gB4Data, gB4InvStokesM, count12DegAveObs, numberBins);
	end;
	
if gB5DataFlag == 1
	gB5Data = ComputeBinDataR(...
					gB5Data, gB5InvStokesM, count12DegAveObs, numberBins);
	end;
	
if gB6DataFlag == 1
	gB6Data = ComputeBinDataR(...
					gB6Data, gB6InvStokesM, count12DegAveObs, numberBins);
	end;
	
if gAverageCimelFlag == 1
	if gC1DataFlag == 1
		gC1Data = ComputeBinDataR(...
						gC1Data, gC1InvStokesM, count12DegAveObs, numberBins);
		end;
		
	if gC2DataFlag == 1
		gC2Data = ComputeBinDataR(...
						gC2Data, gC2InvStokesM, count12DegAveObs, numberBins);
		end;
		
	if gC3DataFlag == 1
		gC3Data = ComputeBinDataR(...
						gC3Data, gC3InvStokesM, count12DegAveObs, numberBins);
		end;
	
else	% gAverageCimelFlag ~= 1
	if gC1DataFlag == 1
		gC1Data = ComputeBinDataR(...
						gC1Data, gC1InvStokesM, count2DegAveObs, numberBins);
		end;
		
	if gC2DataFlag == 1
		gC2Data = ComputeBinDataR(...
						gC2Data, gC2InvStokesM, count2DegAveObs, numberBins);
		end;
		
	if gC3DataFlag == 1
		gC3Data = ComputeBinDataR(...
						gC3Data, gC3InvStokesM, count2DegAveObs, numberBins);
		end;
		
end;	% if gAverageCimelFlag == 1, else...

	
if gB7NPDataFlag == 1
	gB7NPData = ComputeBinDataR2(gB7NPData, count12DegAveObs, numberBins, 3);
	end;
	
if gCNPDataFlag == 1
	gCNPData = ComputeBinDataR2(gCNPData, count2DegAveObs, numberBins, 3);
	end;
