singleLED = load('hdrCalGamma_1x1')
LEDvalue=unique(singleLED.inputs(:,2));
lowlevel=find(LEDvalue<=10);
LEDvalue(lowlevel)=[];

figure;
for ii=1:length(LEDvalue);
x = singleLED.inputs(find(singleLED.inputs(:,2)==LEDvalue(ii)),1);
y = singleLED.XYZ(find(singleLED.inputs(:,2)==LEDvalue(ii)),2);
plot(x,y/max(y),'bo');
g = fitGamma(x,y);
singleLEDGamma(ii,1:2)=[g LEDvalue(ii)];
hold on;
plot(sort(x),gammaFunc(g,sort(x/max(x))),'r:');
end
hold off;

xlabel('LCD levels');
ylabel('luminance cd/m^2 scaled to 1');
title('LCD response with a single LED');
%legend('measured');
legend('measured','fitted');
grid on;

singleLEDGamma_mean=mean(singleLEDGamma(:,1))