function WriteAllDataToDisk(index, wfid)

global 	gB1DataFlag...
		gB2DataFlag...
		gB3DataFlag...
		gB4DataFlag...
		gB5DataFlag...
		gB6DataFlag...
		gC1DataFlag...
		gC2DataFlag...
		gC3DataFlag...
		gB7NPDataFlag...
		gCNPDataFlag;
		
global 	gB1Data...
		gB2Data...
		gB3Data...
		gB4Data...
		gB5Data...
		gB6Data...
		gC1Data...
		gC2Data...
		gC3Data...
		gB7NPData...
		gCNPData;

	% Write the data (I, Q, U, P, Chi, Rp) to disk for
	% the requested index (bin).
	
if gB1DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gB1Data(index,1:6) );
	end;
	
if gB2DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gB2Data(index,1:6) );
	end;
	
if gB3DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gB3Data(index,1:6) );
	end;
	
if gB4DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gB4Data(index,1:6) );
	end;
	
if gB5DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gB5Data(index,1:6) );
	end;
	
if gB6DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gB6Data(index,1:6) );
	end;
	
if gC1DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gC1Data(index,1:6) );
	end;
	
if gC2DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gC2Data(index,1:6) );
	end;
	
if gC3DataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t\t',...
		gC3Data(index,1:6) );
	end;
	
if gB7NPDataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t',...
		gB7NPData(index,1:3) );
	end;
	
if gCNPDataFlag == 1
	count = fprintf(wfid, ...
		'%6.2f\t%6.2f\t%6.2f\t',...
		gCNPData(index,1:3) );
	end;
	
