function [I,ok] = GDM_GetCurrent(h)
%function [I,ok] = GDM_GetCurrent(h)
% Reading DC current from GDM multi-meter.
% Make sure to connect to the right port for current measurements!
% Author: Philipp Häfliger, 29-Jan-2025
ok=0;
stderror=2;
if ~isobject(h)
    fprintf(stderror,"Error: parameter h is not a valid object handle\n");
    return;
end; %if
if isempty(strfind(h.Address,"gdm"))
    fprintf(stderror,"Error: device handle is not associated with a multimeter\n");
    return;
end; %if
I=double(h.writeread("measure:current:DC?"));
ok=1;
end