www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@calibrationdata/@visionv2interface/getValue.m

    function value = getValue(obj, identifier)
%GETVALUE  Get value from calibration.
%
%  VALUE = GETVALUE(CAL,IDENTIFIER) gets the value with identifier
%  IDENTIFIER from the calibration CAL.
%
%  See also GETAXIS, GETCURVE, GETMAP, GETITEM.

%  Copyright 2000-2010 The MathWorks, Inc.


% Get matching interface(s)
iValue = obj.pGetIValue(identifier);

% Construct object(s)
nValues = numel(iValue);
value = mbcutils.handleArray(nValues, 1); % preallocate
for i = 1:nValues,
    try
        value(i) = iValue2Value(iValue(i), obj);
    catch ME
        error(message('mbc:calibrationdata:visionv2interface:FileReadError3', phGetShortIdentifier( obj, iValue( i ).FullDataItemName ), ME.message));
    end
end

% -------------------------------------------------------------------------

function value = iValue2Value(iValue, obj)

% Construct value object
value = calibrationdata.value;
value.Identifier = phGetShortIdentifier(obj, iValue.FullDataItemName);
value.Units = iValue.EngineeringUnits;
value.Format = sprintf('%%.%df', iValue.DecimalPlaces');
value.UpperLimit = iValue.MaximumLimit;
value.LowerLimit = iValue.MinimumLimit;
value.Value = transpose(iValue.ProposedValue);
value.CalibrationInterface = obj;

% The following properties are not fully supported: Description, DataType