pH_failures = readtable('C:\Users\bwerb\Downloads\BadSensorListasExcelSheet.xlsx','Sheet','pH Failures');
Sensor_SN = readtable('C:\Users\bwerb\Downloads\BadSensorListasExcelSheet.xlsx','Sheet','Sensor SN');
%%
idx = nan(size(Sensor_SN.WMOID));
for i = 1:length(Sensor_SN.WMOID)
    idx(i) = ismember(Sensor_SN.WMOID(i),pH_failures.Var1);
end
idx2 = nan(size(pH_failures.Var1));
for i = 1:length(pH_failures.Var1)
    idx2(i) = ismember(pH_failures.Var1(i),Sensor_SN.WMOID);
end

pH_sensors_that_got_cooked = Sensor_SN.WMOID(logical(idx));
Number_of_cycles = pH_failures.Var4(logical(idx2));
Mean_Number_of_Cycles = mean(Number_of_cycles);

disp(['DuraFET average cycles until broken: ', num2str(Mean_Number_of_Cycles)])