% Read Photocurrent for given reverse bias voltage
% [PhotoCurrent] = keithley_read(address,voltage);
function [PhotoCurrent] = func_keithley_read_photocurrent(address,voltage)

fprintf(address,':SOUR:FUNC VOLT');        %Select voltage source.
fprintf(address,':SOUR:VOLT:MODE FIXED');  %Fixed voltage source mode.
fprintf(address,':SOUR:VOLT:RANG 3');      %Select 3V source range.
fprintf(address,':SENS:CURR:RANG:AUTO ON');%10mA measure range.
fprintf(address,':SENS:FUNC "CURR"');      %Current measure function.
fprintf(address,':FORM:ELEM CURR');        %Current reading only.
fprintf(address,':OUTP ON');               %Output on before measuring.            
command = [':SOUR:VOLT:LEV ' num2str(voltage)];
fprintf(address,command); 
fprintf(address,':READ?');                 %Trigger, acquire reading
PhotoCurrent = scanstr(address,',','%f');
%fprintf(address,':OUTP OFF');              %Output off after measuring            