function [value, status] = LCGetSingleParameter(obj, channel, param)
% LCGETSINGLEPARAMETER Retreive a measurement parameter from the scope.
% V = LCGETSINGLEPARAMETER(OBJ, CHANNEL, PARAM) returns the value of
% parameter PARAM, measured on channel CHANNEL, using instrument control
% object OBJ.
%
% [V S] = LCGETSINGLEPARAMETER(OBJ,...) returns the status of the
% scope S as well.
%
% Possible CHANNEL values are C1, C2, FE, FF, MC, MD, EA, EB.
%
% Possible PARAMETER values are FRST, PNTS, MAX, SDEV, DLY, WID, FALL, LAST,
% MIN, MEAN, RMS, PER, RISE
if nargin < 3
error('Invalid number of arguments. See help for details.');
end
chanNames = strvcat('C1', 'C2', 'FE', 'FF', 'MC', 'MD', 'EA', 'EB');
paramNames = strvcat('FRST', 'PNTS', 'MAX', 'SDEV', 'DLY', 'WID', 'FALL', 'LAST',...
'MIN', 'MEAN', 'RMS', 'PER', 'RISE');
idxC = strmatch(upper(channel), chanNames);
idxP = strmatch(upper(param), paramNames);
if isempty(idxC)
error('Invalid channel name.');
elseif isempty(idxP)
error('Invalid parameter name.');
end
command = sprintf('%s:PAVA? %s', chanNames(idxC,:), deblank(paramNames(idxP,:)));
fprintf(obj, command);
response = fscanf(obj);
[T R] = strtok(response, ',');
[T R] = strtok(R, ',');
value = sscanf(T, '%f');
[status R] = strtok(R, ',');